Getting WA in this problem. My Solution . I tried Heavy-Light-Decomposition for the first time. But don't know why getting WA. can you pls help me to find out the bug or any test case that my code fails..
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Getting WA in this problem. My Solution . I tried Heavy-Light-Decomposition for the first time. But don't know why getting WA. can you pls help me to find out the bug or any test case that my code fails..
Name |
---|
You can refer to http://spojtoolkit.com/problems/ for finding test cases and their solutions to some of the spoj problems.
May be there is a problem is the source code of QTree problem. i tried available test case 10.
this test case has 6 query. but the Generated output is only 55.
For this example:
Your code gives: 55
70
100
80
70
75
And my AC code gives:
55
70
100
250
70
100
A possible reason is here:
Your (incorrect):
Correct:
P.S sorry for my bad english.
P.S2: I'm assuming it's the only mistake. I hope it helps you. P.S3: Draw the tree for thinking about the mistake.
yes.. now i get it.. Here each node contains the cost of the edge between it's parent & itself. so "up" contains the cost of the edge connecting with it parent. But we need not count this cost actually. we need to count the immediate child of "up" in this chain through "vp". that's why it was WA.
Thanks for reading my code & helping me to find out the bug..