ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1275. Knights of the Round Table

int2k Please help me with a little hint [1] // Задача 1275. Knights of the Round Table 27 авг 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!
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.