HW2, all test passed on my pc but 3 failed when I upload the file

SaverioPas (710 points)
1 4 6
asked Nov 5, 2021 in HW2 by SaverioPas (710 points)
recategorized Nov 6, 2021 by andrea.sterbini
I've just uploaded my solution to  the homework. When I tested it on my pc it gives 16/16 test passed but when uploaded only 13 out of 16 test are completed successfully.

Don't know what else to do.

https://imgur.com/a/SO015wp

Here are 2 screenshot of the problem.

1 Answer

Best answer
GabrielAlexandru (7760 points)
2 4 29
answered Nov 5, 2021 by GabrielAlexandru (7,760 points)
selected Dec 4, 2021 by SaverioPas
If you go to the correctness tab you should see why those 3 tests failed. With only the screenshots you gave us we can't do much.
SaverioPas (710 points)
1 4 6
commented Nov 5, 2021 by SaverioPas (710 points)
Uh, ty, I think I got the point. The test failed were the long ones and they were failed due to exceeding the 6s timer.

I'll leave the post here in case anyone will have my same problem
GabrielAlexandru (7760 points)
2 4 29
commented Nov 5, 2021 by GabrielAlexandru (7,760 points)
I'm glad that you found the error! Hopefully you find a way to solve it too!
e
elisa_terzini (180 points)
0 0 1
commented Nov 5, 2021 by elisa_terzini (180 points)
I had the same problem, thank you for sharing, I just resubmitted the program optimizing the code, but I'm not sure it'll be fast enough, any suggestions for the optimization?
GabrielAlexandru (7760 points)
2 4 29
commented Nov 5, 2021 by GabrielAlexandru (7,760 points)
The optimisation really depends on your code, so I can't suggest you a lot of things, except maybe the most obvious one: reduce the amount of loops in your code (if you even have any).

I'm sorry I can't do more...
e
elisa_terzini (180 points)
0 0 1
commented Nov 7, 2021 by elisa_terzini (180 points)
Thank you for the tip, at the end I just created some variables at the beginning of the program and used those to shorten the code:)