1517. Freedom of Choice

Problem Name:
1517. Freedom of Choice
Site:Timus
Links:
Tags:
Problem setters:
Ilya Grebnov, Nikita Rybak, Dmitry Kovalioff