×

JULY LONG CHALLENGE 2017 PROBLEM DISCUSSION

 3 Can someone discuss the solution of Tree Expectancy , Pishty and tree and Two Coins ? asked 17 Jul '17, 18:23 497●1●8 accept rate: 15%

 4 expression tree editorial is here @tihorsharma123 https://discuss.codechef.com/questions/105248/exptree-editorial :) answered 17 Jul '17, 23:00 66●2 accept rate: 50%
 3 For Two Coins problem, You may see that leaves should definitely have a coin, and after that while moving towars root from leaf I tried to put a coin as late as possible depends on various conditions, During contest I had to insanely commented out my code to handle various conditions explicitly and to apply greedy type approach there. Here is my whole commented out solution, hope this will help: https://www.codechef.com/viewsolution/14561922 If you see, during recursion my base condition was leaf node, and I used 6 type of variables(Made it little complicated but it was clear for me though): Help that can be provided from one level children (directly connected) Help that can be provided from two level children (children of children) 3,4. Flexible Help(That can be delayed to further to above parent of parent) needed by one level children and two level children seperately 5,6. Hard Help(That can not be delayed to further to above parent of parent) needed by one level children and two level children After this you can see how I used these variables in recursion to pass help and requirement by children. Hope this will help. answered 17 Jul '17, 22:51 1.1k●1●10 accept rate: 19%
 2 @tihorsharma123 Editorial for TWOCOINS. answered 18 Jul '17, 14:52 76●1 accept rate: 25%
 0 @kauts_kanu In this problem (TWO COINS), will a node with a lower number will always be the parent of the node with a higher number? answered 18 Jul '17, 12:18 12●3 accept rate: 20% 2 Nope, That's not necessary.. I will say, Don't assume anything until it's mentioned in question specifically.. Btw, Why are you asking this? It will not be required anywhere as we are using dfs using recursion and using node numbers just to identify root node specifically and to track visited nodes. (18 Jul '17, 17:57)
 0 Editorial for Phisty and Trees anyone ? answered 18 Jul '17, 17:30 1 accept rate: 0% https://discuss.codechef.com/questions/105181/pshttr-editorial (18 Jul '17, 19:05)
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×158

question asked: 17 Jul '17, 18:23

question was seen: 828 times

last updated: 18 Jul '17, 19:05