SPOJ-FREQUENT — Frequent values

Revision en1, by S.J.patel, 2017-07-04 16:37:16

Hi, Question: http://www.spoj.com/problems/FREQUENT/

I am getting WA in my below mentioned Code and i have tried many test Cases but the issue still remains same. Can anybody please help me? My basic logic is that when the best left part and the best right part are both of the same element, then the parent node made from these two parts will have the best made of the same element and frequency equal to the sum of the best left and right frequencies.

And if the best left and best right are not of the same element, then I'll check if the two child segments are internally joined by some common element.

Code: https://ideone.com/uhftBt

Tags segment tree, advanced data structure, solution spoj

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English S.J.patel 2017-07-04 16:37:16 684 Initial revision (published)