№ | Пользователь | Рейтинг |
---|---|---|
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 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
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 |
Название |
---|
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:)