Doge_Wick's blog

By Doge_Wick, history, 7 years ago, In English

My submission 28543110 for problem 828C - String Reconstruction 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

| Write comment?
»
7 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.