I solved 1084F - Max Mex in archive. As a result, my O(q·nlogn) (due to LCA in linear time) solution gets OK (but n = q = 200 000).
Of course, there is a simple test to get Θ(q·nlogn) and working time >10min.
Is there any way to add this test to the testing system? Does it make sense?