Problem: 1678A - Tokitsukaze and All Zero Sequence
Verdict: Wrong answer on test 8
Checker comment: wrong answer 986th numbers differ — expected: '0', found: '-1'
This is my submission: 156338916
1: When scrolling through the submission list, including other contenders, I didn't find another verdict with 'Wrong answer on test 8'. (At least not so far, I will continue looking for it.)
2: I tried to use submit again without a "\n" at the end. Same verdict.
3: Memory looks okay.
4: Time looks okay.
5: When looking through the testcase details, is there a way to see the exact testcase input/output instead of the '...'?
6: Numbers aren't to big for int, so long or long long isn't needed.
7: Could there be a problem with my size_t in the for loop?
8: What am I missing here?
Any help regarding this is highly appreciated.
Kind regards and happy coding,
setuid0
edit: This is the corrected and accepted solution:156359415 The Problem was the while loop for all elements zero. Thanks for the help!
You cannot use a while (vec[j]==0) because it will go out of bounds when all of the elements are 0. It is only because of C++ you get wrong answer instead of runtime error. You have to use a normal for loop or a for-each loop.
Dry run your submission on this testcase, printing the value of each variable after any modification.
Ticket 6767