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 | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | 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..