Mr.King.'s blog

By Mr.King., history, 4 years ago, In English

Hi codeforces! I was deleting the element from ordered map but when i delete the last element from map then i got the RE! why? :(

code
  • Vote: I like it
  • +2
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

iterators don't work that way

if you erase like in the code, then it will be invalidated, or you can say it "doesn't work" anymore

you can just call a.erase(a.begin()) twice