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

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

Hi I recently learned about tries and tried this question---- http://codeforces.net/contest/514/problem/C this is my solution to problem ---- http://codeforces.net/contest/514/submission/12742436 I would be glad if someone could take some time and explain what might be wrong with the solution , I have tried to add necessary comments to explain my approach.

PS- I was successful in solving this question using polynomial hashing but wanted to solve this using tries.

Thanks in advance.

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

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

I don't see why do you get WA, but anyway it won't pass because it does O(|s|2) operations for each string and that's too slow

  • »
    »
    9 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    while coding it didn't strike me , but indeed it is O(|s|**2). Thanks for pointing that out . It would be great if you can offer any other suggestions on how it can be solved using tries . Thanks again.

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