← Back to topics
Topic

z-clock

M
Martin
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
m
mbalunovic

printf ("%.3llf",rj[i])


Try changing printing and reading doubles from llf to lf -

Like this:


printf ("%.3lf",rj[i])

M
Martin
Thanks, I can't believe I didn't see that.
Well it still doesn't pass all tests but two of them work. I guess my solution is wrong, please tell me if my solution is completly wrong or I just need to change something in this solution.
m
mbalunovic
Your answers are ok but it differs from correct answers in decimal places.

For example,
correct solution is 11781.818
while your code gives 11781.819

Now, to improve this, you need to find maximal k such that
43200.0 / 11.0 * k >= N

If you need any other hints, just ask.
M
Martin
I already solved it. Thanks anyway.