Redaksiya
Subtask 1
In the first subtask, the limits are very low, and almost any brute force solution passes. One solution is as follows. Consider a fixed permutation of lanterns. Note that we can always buy the first one by definition.
Assume that
Subtask 1
In the first subtask, the limits are very low, and almost any brute force solution passes. One solution is as follows. Consider a fixed permutation of lanterns. Note that we can always buy the first one by definition.
Assume that