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

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

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?

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

»
7 лет назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

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.