Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Comments

Is it really that difficult in the end it is just ( L^2 — H ^ 2 ) / 2 * H

+11

Yeah , sparse table . But to reduce memory char had to be used instead of int . The other part is just persistent segment tree .

+4

It can be solved in O( N*logN*67+ Q*logn + Q*67) . Though it just passes all the tests . Code : http://ideone.com/loLaMW

There were cases where i had used all the numbers from 2 to 300 twice. But all bruteforce solutions solved it within 1s.

Yes that was the intended solution . Unfortunately i could not take into account all the greedy approaches :( and set appropriate input . I however hope that you liked the problemset :). Is there any input for which the bruteforce solution will TLE ? If yes how to generate one ?

I was the author of the problem PSEQ. The expected solution had a time complexity of around 3^7*600 . Exhaustive search was supposed to TLE but sadly it passed. Regarding the TL set in MODQ we had tested for bruteforce solutions in C++ and it was TLE'ing but had no idea that with Java even a bruteforce solution would pass .