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

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

Hi everyone, I was attempting the following question: http://www.spoj.com/problems/FREQUENT/

I tried to use Segment trees for this question but I am getting WA. Please help me get an idea about where I am wrong. Here is the link to the code: http://ideone.com/leiE86

Thanking you, Maulik

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

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

What about your search , when you found a empty segment (Line 82) you are puting many flag values this strategy is correct , but you are forgeting what to do when in (Line 82) when your get recursively from LEFT and RIGHT , and imagine that LEFT is an invalid segment (in this case i think that you are not considering this case) the same when RIGHT is an empty segment.