Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

Автор Adonis_, история, 5 месяцев назад, По-английски

I have a complain. I have solve Question B & C of Codeforces Round 931 & it was succesfully run in pretests, but after the contest it's showing runtime error. & submitting the same code after the contest it is succesfully accepted. Please tell me how it's happened. harsh__h

C: During Contest & after contest

B: During Contest & after contest

[Later Edited]: I have got the problem that it's due to vector size declaration of 30, but i am confused why it didn't give runtime error on test 1 instead of this later cases.

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

»
5 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
5 месяцев назад, # |
Rev. 2   Проголосовать: нравится +7 Проголосовать: не нравится

You're right, both solutions are exactly the same character by character.

It could be because of an array out of bound, but I think CodeForces usually use -fsanitize=address to give a meaningful error, not just a random exit code.

Alse, it can be because of Operating System error that occurred during contest which can't be controlled. But it was unfair for you, and CF team should give an explanation.

  • »
    »
    5 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Yes if the runtime error would have appear during the pretest I would have changed it, a penalty of -50 is far better than awarding 0. MikeMirzayanov Please look into this

»
5 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Because it is undefined behavior. Documentation

Portable programs should never call this function with an argument n that is out of range, since this causes undefined behavior.

A similar member function, vector::at, has the same behavior as this operator function, except that vector::at is bound-checked and signals if the requested position is out of range by throwing an out_of_range exception.

»
5 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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