Please subscribe to the official Codeforces channel in Telegram via the link: ×

Badry's blog

By Badry, history, 12 months ago, In English,

My code in this 33193614 gives me run time error in test 9. The problem is that the code gives run time error after printing the output which is the very last line in my code !!!! .. any idea what may cause this run time error ?


Tags c++, rte

12 months ago, # |
  Vote: I like it +8 Vote: I do not like it

The RTE at the end of the execution usually happens when your memory gets corrupted. Theoretically, if you have an undefined behavior, anything can happen (including printing the right answer).

BTW I strongly believe that you can find the error by yourself. Note the new "Diagnotics" part at the end of the test result:

Error: attempt to subscript container with out-of-bounds index 192, but container only holds 192 elements.

Objects involved in the operation:
sequence "this" @ 0x004F8044 { type = std::__debug::vector<long long, std::allocator<long long> >; }

So at which vector of size 192 may you attempt to access out of bounds?

  • »
    12 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thanks so much i found the error.