Official
A - i i's Editorial by evima
After the sequence \((1, 2, 3, \ldots, N-2, N, N-1)\),
- \((N, N-1, N, N-1, \ldots, N)\),
- \((N-2, N-3, N-2, N-3, \ldots, N-2)\),
- \(\ldots\),
- \((3, 2, 3)\) or \((2)\)
concatenated in this order satisfy the conditions in the problem statement. For the last sequence, choose \((3, 2, 3)\) if \(N\) is odd and \((2)\) if \(N\) is even.
(Example) For \(N = 5\): \((1, 2, 3, 5, 4; 5, 4, 5, 5, 4, 5, 4, 5; 3, 2, 3)\)
(Example) For \(N = 6\): \((1, 2, 3, 4, 6, 5; 6, 5, 6, 6, 6, 6, 6, 5, 5, 6, 5, 6; 4, 3, 4, 3, 4; 2)\)
posted:
last update: