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

Обсуждение задачи 1208. Соревнование легендарных команд

Ayhan Aliyev [BOTL] So easy. [3] // Задача 1208. Соревнование легендарных команд 9 фев 2006 22:51
Don't spend your time searching a fast algorithm.
Simple recursive solution which searchs all possible answers gets AC 0.015!!
Yeah, but I have TLE#7!
Firstly I made a table that shows which team can't participate with which one and then used recursion to compute answers.
Note that order of teams does not matter. Choosing teams numbered 2,3 is same as choosing  3, 2 so try to choose teams in increasing odrer.
I hope that it will help you
I'd simply bruteforced it and used DP approach. AC in 0.156 sec on worst test. There are only 18 teams, so we can iterate over all possible 2^18 combinations and store "useful information" from previous iterations in large array. All done with bitmasks