PSHTRG - Editorial

The only reason I can think of -

Weak test cases (lengths of required(valid) triangle were very close to r) i.e. number of queries giving required triangle in less number of iterations >> number of queries giving required triangle in more number of iterations

Ah, yes the intended solution uses something different too. Its a cross between a segtree and a merge sort tree. Thanks for describing the intended one. :smiley:

1 Like

https://www.codechef.com/viewsolution/17834749
@kailashnath199 Thank you Man. Now, i am able to do this question using segment tree.
Thank You.

Please can someone explain to me the math involved behind the limiting the value of K to 50 ?

harrypotter0 For mathematical calculations ,refer to this

Can anyone help me. Why this code is giving TLE?

can anyone just tell me how setter is doing without sorting nodes.

Please can someone help me in improving my solution. I have understood the concept and written a code but it is giving TLE.The complexity is Q.K.log n where k = 45. here is my code Thanks

@ista2000 can you please explain your approach. I am new to segment trees.
Thanks in Advance:)