how to convert this(459d ) problem to segment tree/fw tree problem?

Revision en1, by atlasworld, 2018-12-27 10:50:12

in problem 459d we have to find the i,j pairs for which f(1,i,a[i]) > f(j,n,a[j]])

we will first count left[i] i.e frequency of a[i] in the range [1,i] and r[i] i.e freq. of a[i] from [i,n] .

after that what to do .. how to solve it in O(n) time ..

please help !

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English atlasworld 2018-12-27 10:50:12 389 Initial revision (published)