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

Автор RogueNinja, история, 4 года назад, По-английски

Problem link

This problem is from recent Round #672 (Div. 2). I did a stupid miscalculation (-_-). One of the dimension-size of the array was supposed to be around 3200 but I assigned the size 160. But funny thing is it still got accepted (offline solve btw).

1st Submission link

Later I understood the mistake and submitted the code again which I think is correct. 2nd Submission link

Now, why 1st solution is accepted? Is this something which can be exploited again? Or am I just lucky as there's also another dimension after it which might've persisted the result without conflicting.

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

»
4 года назад, # |
Rev. 8   Проголосовать: нравится +1 Проголосовать: не нравится

Well, this is c++, it does not check array boundaries and just accesses the memory by the address it computed from the dimensions and your indexes.

If calculated addresses are withing the range and did not overlap, I assume it is may be safe, though should not be done. If calculated addresses are outside of the range, then you are lucky if you don't corrupt anything important

In this case it seems you were lucky for the reason you mentioned