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 1865. The Island of Märket

198808xc If you have WA @ 3 or 5. // Problem 1865. The Island of Märket 30 Aug 2012 23:28
If you get WA @ 3, please use 64-bit integers to avoid overflow.

If you get WA @ 5, the following testcase might help:
4 4
1 1 2
The answer is:
6
3 4
3 3
1 3
1 1
3 1
3 0

Good luck.