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

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

Hello Codeforces why this code give me runtime error :

https://repl.it/repls/DeliriousVerifiableBruteforceprogramming

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

»
6 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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!