Why this code is giving me WA in 811C - Владик и запоминающаяся поездка, i used DP the tipical take or not take:
here is my code: 27467986
# | 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 | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
8 | Dominater069 | 154 |
8 | nor | 154 |
Name |
---|
Consider lines 57-58:
You then use this
Sum
array in lines 40-41:The problem is that in the
Sum
array you're considering the xor-sum of a subarray from the first occurrence of a number to its last. However, within this subarray, there may occur other numbers, whose first occurrence is before the beginning or whose last occurrence is after the end. This would make taking such a subarray into the solution illegal. You're not considering this, which is why your answer comes out to be greater than the judge's solution.