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

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

How to solve SPOJ-FREQUENT VALUES "http://www.spoj.com/problems/FREQUENT/" using segment tree?? I want to know what to store in the node of the tree?

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

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

Maximum answer in the interval, number of numbers that are equal to a[r] and number of numbers that are equal to a[l].

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

"a1 , a2 , ... , an in non-decreasing order." This is the key to the solution . Also u need a frequency array and just adjust the queries .