Help me with SUMQ

Here’s my code for the problem SUMQ from June challenge. I am getting wrong answer even with easy constraints. Though I used simplest approach but I think it is correct indeed. I don’t know what’s wrong. Help me out.
https://www.codechef.com/viewsolution/14209998

There, fixed your code a bit. [Here][1] is your code, which works for smaller inputs.

The goto label part was causing the bug because the input is NOT SORTED (Arrays in input need not be sorted!!)
Meaning, the test case can be like-

X= 1,50 ,2,3,4
Y= 50,9,500
Z=,1,999999,23

You would prematurely come out of loop in this case and not complete the calculation, hence the wa. Just removing that thing got a AC on smaller subtask.
[1]: https://www.codechef.com/viewsolution/14255082

1 Like

Thanks a lot. I was subconciously assuming input to be sorted. Thats a silly one. Ha ha.

Setters use all sort of tricks to deceive us :frowning: . Reading problem statement carefully is a must to avoid pitfalls!! :slight_smile: