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

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

Here is the link to the the SPOJ problem FREQUENT: https://www.spoj.pl/problems/FREQUENT/ And here is a link to my solution http://ideone.com/7XiVC I used segment trees to solve the problem keeping the left end number/frequency, the right end number/frequency and the maxfreq number/frequency of a segment. But I am receiving a WA. Could anyone tell me the problem.

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

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

I think that your idea is wrong. You better use sqrt-heuristic here.

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

Your idea is correct. But you mistyped on rows 108-109. At least there are some small mistakes. By the way it is not important which number is the most frequent in whole segment