SPOJ GSS1 WA TEST CASE 9

I am getting WA in test case 9.

problem link:
link text
my Solution:
link text

please tell me where’s the mistake?

Did you try SPOJ test-case toolkit? It has many test cases which may help you debug.

BTW, common things to see are-

  1. Size of tree is ok
  2. When merging two nodes, the result is correct. Say you merge the nodes of [3,]3 and [4,5] , make sure the result stays correct. When i attempted the Q, this was the ONLY case where i failed and it took me 2 days to debug :frowning:

actually the first 8 test cases are useless…because i misunderstood it as range minimum query and passed them…in this problem main thing is to write merge operation…and test your code with spoj toolkit…u will get it

Thanks for responding.I will try the spoj toolkit as suggested.

Thanks for responding.I will try the spoj toolkit as suggested.

few Toolkit test cases are incorrect
input:
3
-1 2 3
1
0 1

output:
-1
I don’t know what kind of indexing he followed.

Now here is the test case input output from problem statement:
Input:
3
-1 2 3
1
1 2
Output:
2