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

Автор sangshaptac, 12 лет назад, По-английски

i have solved some easy problems on suffix array,i think this problemcan be solved using suffix array,but i am not getting any approach that can suffice the time limit.

Please Help by giving idea on how to solve the problem(preferably by using suffix array)...

Thanks in advance :)

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

»
12 лет назад, скрыть # |
 
Проголосовать: нравится -6 Проголосовать: не нравится

I think you can solve it by KMP(knuth morris pratt) or Z-function algorithm.

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

I have solved the question using zFunction... My submission — http://codeforces.me/contest/432/submission/8510013

»
12 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +5 Проголосовать: не нравится

Along with computing suffix array you can compute LCP array (lcp[i] is Longest Common Prefix for adjacent suffixes i and i + 1). Now you can use sparse tables or RangeMinimumQuery to determine how many suffixes have equal prefix of length k.