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

Автор MOOONI, история, 4 года назад, По-английски

Hello codeforces. I was solving this problem in EDU part that I faced a bug. as said in the video, to find the longest common substring of two strings s and t we should first build the suffix array of s + # + t. I did this and this caused me RE on test 2. and it turned out that the reason was the character # is smaller than the character (dollar) that we add to the end of the string at the beginning of building suffix array. but it was said that character (dollar) has to be the smallest character among all characters of the string. so to fix this issue we can use character ~ instead of #. and ~ is also bigger than character z. so we won't face any problem then. I wanted to make you aware of this.

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

»
4 года назад, # |
Rev. 3   Проголосовать: нравится +8 Проголосовать: не нравится

I think we can use char('z'+ 1) when 'z' is biggest character, instead of '#' or '$', to prevent bugs like this.