Getting wrong answer

code is not passing all the test cases.
please check…

code link: https://ide.codingblocks.com/s/270984

@rabhi1611 what if no not present like this case
5
1 5 7 10 12
3
2
3
4
your code gives 1 0 for all but it should be -1 -1 for all