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 1275. Knights of the Round Table

Please help me with a little hint
Posted by int2k 27 Aug 2024 15:00
I devised that maybe I need to solve many systems of equations.

I know the solution if the system has odd equations, but how do I solve the one with even equations?

For example: solve for ai, with ki = initial cups at knight i, and F as the final cups to be achieved.

a1 + a2 + k2 = F
a2 + a3 + k3 = F
a3 + a4 + k4 = F
a4 + a1 + k1 = F

I cannot solve this, even if I could I couldn't image myself programmatically solve it.

If the solution is different, please give me some advise. Thanks!
Re: Please help me with a little hint
Posted by int2k 5 Sep 2024 08:56
For future solver - Basically that's the correct solution despite being optimized or not. For even number of equations, you can solve it directly to save some mem, or you can just bruteforce like me (-1000 -> 1000) for the first value and solve the rest. That will tank the memory alot but it should be fine if you prayed for mercy first before you submit.