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

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

See this submission -> Click.

As you see, I got a runtime error because of "assert" function that I added while debugging my code. My array S is an array of pairs where second value is an index from (1..m). I can not understrand why my code is getting a runtime error. "assert(s[i].second <= m)" should be fine but it leads to an error. Why?

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

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

Look at the size of array a.

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

What is the undefined behavior of C++ here? The title is purely misleading.