Блог пользователя coding_weeb

Автор coding_weeb, история, 9 лет назад, По-английски

Here is the problem's link : http://codeforces.me/contest/877/problem/D

In this problem I used BFS to solve it. In my WA submission I choose to break when the distance from the origin of the cell I am traversing is smaller or equal to the distance of the point of the front of the queue plus 1. In my accepted solution I choose to break when the distance from the origin of the cell I am traversing is smaller or equal to the distance of the point of the front of the queue. But I can't understand why my first solution fail. Can anyone give me the explanation ?

Correct : http://codeforces.me/contest/877/submission/31687084 WA: http://codeforces.me/contest/877/submission/31686998

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Auto comment: topic has been updated by coding_weeb (previous revision, new revision, compare).

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by coding_weeb (previous revision, new revision, compare).

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Undefined behaviour. xx + i can be greater than array size.