Quote:
Originally Posted by Barrin6
Also if your algorithm is correct, it could possibly be because of overflow problems. So check for that.
This reminds me of a problem I once did on a site like that (ran your code against public test cases, then also against private ones). I thought it might be numeric overflow (it was something like mathematical operations on large numbers), so I implemented something like, converting integers to string and then doing multiplication on the two strings the way you learned in school.
I then later realized that if I switched to Python it just worked, lol.
Also reminds me of doing a similar thing (except, no public test cases) that I kept failing. I noticed it would report certain crash states in the test output (like, it would print something different for segfault vs. stack overflow vs. exit code 0) so I started using intentional crashes as a version of printfs, hiding them in conditionals and re-running to see exactly what was causing my program to misbehave. Eventually realized I had an incredibly dumb, obvious bug that I had just been working on the code too long to notice.