Hello , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of1000000007
Can anyone please help me too…
Thanks in advance
I also thought of the same approach. But it appears that my implementation might have had problems. Can anyone help me with this? The weird thing is that if I remove the MOD inside the function, then my last test case fails and the test case 4 passes. The solution I wrote is given below.
https://www.codechef.com/viewsolution/46648098
Okay, I took care of some cases I didn’t consider before because I didn’t understand the input. But I am still failing the last two cases. Can someone help in this?
Hello Akash , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of1000000007
[/quote]
getting WA for Test 1 and 2
Link to code : TREEHOUSE - Pastebin.com
Please fix this one and help me understand what went wrong.
Thanks in advance
They will not reveal test cases where the program failed
Bro, i dont know java so I cant really help much.
Bro thanks a lot for response
https://www.codechef.com/viewsolution/46668706
my first two test cases are not passing any suggestions
I did consider the structure of tree but got WA in test case 1 and 2 because I made directed graph. But when i converted it to undirected graph(leaving everything else unchanged), case 1 and 2 passed. Is there any problem with cases 1 and 2 because this isn’t suppose to happen. If you make undirected graph then you have to anyway skip the edge to parent, thats why i made directed graph. Please clarify this. And btw, atleast after the contest is over codechef should show the test case on which our code failed. How am I supposed to learn anything new if I dont get to know what was my mistake?
yupp, codechef have to show test cases at least for long challenge
https://www.codechef.com/viewsolution/46672678
Can someone please check this? I am only able to pass the first two test cases.
Hey, I can pass only the first two test cases. Maybe we can check each other’s code and get an insight into what’s wrong with ours.
ok did you applied the same approach
Mod will not reduce the value in any case
Hello Leo, please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
I can actually explain the reason. But before that, I want you to try a problem. Don’t worry, I will provide you with the link, what you are actually supposed to do is, implement the solution in Java and run against the input that follows.
Problem Link: Josephus Problem - GeeksforGeeks
Input:
N = 1000000
K = 10000 (In fact, value of K doesn't matter).
PS: I really have a solution. I actually wanted to start a thread on this.
Oh, actually I don’t use Java. I use C++ or Python.(mostly C++)
convert n in to binary and left shift be 1,append 0 at right extrem
Regards
Samuel