Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

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

Problem Link

I was trying to solve Distinct Substrings on spoj.I know it can be solved using Suffix Array But I think it can also be solved using Trie......here is my solution which is getting SIGSEGV (don't know why).Please tell me where i am wrong.

My C++ code

what i did: for string ABABABB taking substring of it : ABABABB BABABB ABABB BABB ABB BB B putting it into Trie one by one.Whenever new character is inserted count is increased by one. Each node has 26 child.

Can anybody tell me why i am getting SIGSEGV. Thanks in Advance... :)

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

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

I haven't solved the problem yet, but this comment from spoj looks relevant to your case..

Dont assume the characters to be alphabetical, dont subtract 'A' in deciding the rank.