https://www.codechef.com/viewsolution/26202039
This is my solution. It was rejected by Codechef in the contest. Can anyone tell me the reason behind it.
Try running it on a testcase where T=1, N=10^5, K=3, and every element in the array is 10^5.
1 Like
Your code is mostly correct, it fails for the following case :- 1
5 6
1 2 3 4 5
Happened to 90% of the people in the contest, it made me so sad that I left the contest
1 Like
I think range of integer is under these conditions. Meanwhile I had tried to submit this code in ‘long’ datatype too but not get accepted.
I tested your solution just now, it fails for the case the I mentioned above , fix it and you’ll get AC
Thanks mate…!!
I should have taken this condition too. Nevertheless, it was my mistake and I accept it.
1 Like
https://www.codechef.com/viewsolution/26201015
Why is this sol wrong? It works for the tc you given above.