VasuOberoi's blog

By VasuOberoi, history, 5 years ago, In English

PROBLEM LINK:https://codeforces.me/contest/1468/problem/C

When i am taking int to long long the verdict is :RUNTIME ERROR ON TEST 39 When i am taking int:Its getting accepted

Runtime Error submission Link:https://codeforces.me/contest/1468/submission/126266278

Accepted Solution Link:https://codeforces.me/contest/1468/submission/126266726

WHAT IS THE CAUSE OF RUNTIME WHEN I AM TAKING INT TO LONG LONG.Please explain.

I am always take my int to long long.After this incident i will be scared to take int to long long.Please Help

THANKS IN ADVANCE

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
5 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

If I had to guess, your runtime error could be caused by erasing the beginning of for_monocarp before dereferencing it (calling for_monocarp.erase(it); before int ss = *it;). Erasing an iterator invalidates it, so in general, dereferencing is no longer possible. However, you may have simply been lucky and had no issues from this with your second version.