SuperLAVA's blog

By SuperLAVA, history, 6 years ago, In English

Hello Codeforces why this code give me runtime error :

https://repl.it/repls/DeliriousVerifiableBruteforceprogramming

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

| Write comment?
»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Oh Hi, SuperLAVA!

You are trying to delete non existing characters by using d.erase(j,j+1);. You should use d.erase(j,1);. (See documentation of erase). And you are not updating n with the size of the string after deleting some characters. Here's your code after editing 41826992. But it's complexity is O(N^2) which can not pass for N=200'000. Have a nice day!