I was solving a question on codeforces. Sample test case are giving me correct answer in terminal but it is different in codeforces submission.
Link to submission. My terminal gives me a correct answer of
yes 1 3
but it is no in codeforces. How do I debug in such a situation?
Look for undefined behavior. In your case, it should be this line:
for(int i; i < n; ++i){
. You need to initialize the counter first. Corrected, it passes through 6 tests: 39749555.thank you...