Hello there
I'm trying to solve this problem with this code
Now what I'm doing is building a segment tree with a treap in each node that keeps the position of the next equal number in the array for every number in range
after numerous WAs i got TL and while testing my code on extreme cases i found out it really does take a very long time to execute for 50000 ... the extreme case
My code's complexity is supposedly N*log^2(N) which should be fast for this size of input
what am i doing that's so slow ??
please help :/