# | 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 | -is-this-fft- | 158 |
6 | adamant | 157 |
6 | awoo | 157 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | djm03178 | 153 |
Name |
---|
dp[curr][(abs(l-d))]
why do you think it is enough to know only abs(d-L) ? If d = 5 you have to consider both cases with L = 4, and with L = 5 not only one of them. Usedp[curr][360 + l - d]
UPD: there is mistake in the text. "both cases with L = 4, and with L = 6" abs(4-5) == abs(6-5)
i guess dp[curr][abs(l-d)] takes care of this. if d=5,then l=4,5,6 and the dp states will be dp[9][1],dp[10][0],dp[11][1]. if i am incorrect please correct me!
in the example below func reaches island 1138 with L = 92 first, and for abs(100-92) == 8 remembers result 1. Then func reaches island 1138 with L = 108 and returns answer 1 because abs(100-108) == 8. It's wrong.
n = 2, d = 100
1138
1138+109
your answer is 1, but it's 2.
Thanks so much ..got it:)