wrong answer for NOTATRI

Hello everyone,
I tried my best to solve this problem


but am getting WA. I have thought a lot upon the cases i am missing but could not figure out any. Could anyone please provide some cases for which my code doesnt work or tell where I have went wrong??
I know its wrong on my part to tell you to do the testing but have tested a lot and am helpless…
my solution is here : http://www.codechef.com/viewsolution/1656460
The algo i have used is pretty straight forward… I first sort the numbers…then select pivot as one side…(end is considered as the second side) and using these i find the impossible triangle triplet using b_search…
Please help!! Thanks in advance

Your code does not work on the following case :
5 (number of numbers )
5 6 7 10 11 ( the actual numbers )
0 (end of input )
The answer here should be non-zero certainly as 5 , 6 , 7 is a valid triplet , but your code gives an
answer = 0 .
I normally code in Java and have not coded in C++ for long time , so had a bit of trouble understanding your code quickly , so I didn’t try to find a logical bug in your code . But certainly you can use the above test case to debug your program .