Doge_Wick's blog

By Doge_Wick, history, 2 years ago, In English,

My submission 28543110 for problem 828C - Восстановление строки of the Round 423 based on VK Cup gives me a Runtime Error. I'm kinda new to the thing. Can you help me find it?

About my solution: - s is the collection of strings. - maxstring[i] stores the index of the string that starts from position i and has greater length than all the other ones starting at i. - ans (string) stores the final answer. - maxsize denotes the size of the ans.

Edit 1: Changing N from to 2e6+6 gives me TLE. How did this happen?

 
 
 
 
  • Vote: I like it
  • -13
  • Vote: I do not like it

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Doge_Wick (previous revision, new revision, compare).

»
2 years ago, # |
  Vote: I like it +10 Vote: I do not like it

I think your code does following:

1. int maxstring[N]; In line 4. Your code defines an array with size N.
2. if(maxstring[N] != -1) In line 31. Your program moves the N-th element of array.
3. N is const int and unchanged. So it will be Runtime Error because array index starts from 0.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Oh my god! How did I not see that! Replaced N with start and AC in one go. Thanks a lot buddy :)