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

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

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 ?

Thanks.

Теги c++, rte
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

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

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?