The Smallest Pair Wrong Answer, Help Please

Hi, I’ve just started practicing in Code chef. I submitted my answer of the problem ‘The Smallest Pair’ but it showed that the answer is wrong. It’s showing right answer for Sample Input on my PC. The link to my source code is: http://www.codechef.com/viewsolution/4824610
Help Please…

Hey, instead of for(ll j=0;j < n;j++), it should be for(ll j=0;j < n-1;j++). Because : 1 ≤ i < j ≤ N.Even if you get correct through this method you will get partial points.Try of some other approach to get 100 points(may be sorting approach).

1 Like
//