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

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

https://codeforces.com/contest/1364/submission/85603351

pls tell me why the above code shows runtime error on test case 6.

Someone pls correct this code

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

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

You could assert that the set is not empty here auto it = s_minus_sq.begin(); before dereferencing it.

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

    Yeah, that's working thanks!

    But I think that the condition never arrives at which s_minus_sq.size() is 0 and control is at else if . That's why I haven't checked that condition.

    Can you tell me what lead you to that?

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

      The Checker Diagnostics looks like access to "bad" memory, and I did not see any other line of suspicious code.