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

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

I was trying this question and i got WA at case 3. Problem Link:- http://acm.timus.ru/problem.aspx?space=1&num=1713

My approach includes constructing a suffix array on string formed by concatenating all the strings(commands) given in the input.

Then for each index belonging to the command i am calculating the max value of LCP that can be formed using other indexes belonging to other commands. For doing that i am calculating the closest indexes to that index not belonging to the same command using the Array sorted in order of suffixes.

For any command the answer of that command will be the smallest value of LCP of indexes belonging to that command described as above .

I am unable to find any bug . So please Help ......

This is my code :- http://ideone.com/8veKxE

This is my first post , so kindly ignore any mistakes .

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

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

You can write any easy-to-code solution, generate some small random test cases and compare the answers. This should help you to find your bug.