ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1588. Jamaica

About WA7 (and some other WAs)
Posted by ivanovmp 1 Sep 2022 22:28
I walked through all topics in discussion, grabbed every test, but still got WA7.

I had several mistakes in my solution.

First of all, in some versions I forgot to make fixed format of output and forgot to cast my answer to integer type, therefore the solution printed the answer in scientific notation.

Test:
25
7217 6651
7358 2764
7034 5638
2431 6831
6550 2019
2334 1524
3375 4802
5960 4579
7078 1798
3176 7335
5872 3950
179 7351
9800 3982
2080 897
9345 2389
6470 6556
8420 9316
1671 7557
922 2613
9464 6735
1865 8925
6701 3365
6519 6665
9458 1535
8792 4383
Answer:
1495422

In some solutions there were rounding issues, I rounded down while should have rounded up.
Still I disagree that sometimes one should use floor(ans) instead of int(round(ans)), the latter always works fine in this problem.

Test:
3
4826 9656
137 7424
8340 2686
Answer:
22472

In some attempts I accidentally used = instead of ==, this test detected this perfectly.

Test:
4
0 0
2 0
2 2
0 2
Answer:
14


Edited by author 01.09.2022 22:29