I am trying to solve a problem, "Kefa and Park", https://codeforces.me/problemset/problem/580/C Here is the code I wrote and it does not give right answer for test case 12. Please, help me out. https://codeforces.me/contest/580/submission/47677278
My code builds a tree as per the question. After I build the tree, I do perform DFS. I have a stack in which I first put the first element (Root). Now, for every iteration for as long as there is an element in the stack, I check if its parent has a non zero value of number of cats in the path and if it has, I add the number of cats at that node to the upper number and if it does not, then, I switch it to the number of cats at that node. Now, if I reach the leaf and the number of consecutive cats in that path is less than or equal to the required number, I increase the number of valid paths by one.
You gave the wrong link to your code
LoOoOOOoooOooOooOooOLoOoOooOOOLOoOoOoOoOLOoooOooooOoL.
Can you not just throw the code at ppl and ask for help? Explain what your code does. Make it easy for people to help you.
I think CF badly needs ppl to screw posts such as this so that ppl can learn to write better blogs.
Unrateds can change their rank to something else but rateds can't change their ranks to unrated?? Mike, fix it.
Here you are:
DFS?