I think my solution is good, and it works on my PC. But when I send it I get "Invalid memory reference (memory limit exceeded)" on every test case. Usually this happens when an array is too small but 20 is enough. This is my code I hope somebody finds my mistake:
code removed
EDIT:
I made some changes and now I'm not getting memory limit exceeded, now I'm getting all WA.
You can see my code here:
http://www.z-trening.com/submit.php?submit=7100062829&subm_code=1
code removed
EDIT:
I made some changes and now I'm not getting memory limit exceeded, now I'm getting all WA.
You can see my code here:
http://www.z-trening.com/submit.php?submit=7100062829&subm_code=1