以下页面来自赛事官方发布的原题PDF,已完整保存并渲染到本地。

可复制的 PDF 提取文本
ICPC 2018 2019, NEERC Northern Eurasia Finals, Online Mirror
St. Petersburg Barnaul Tbilisi Almaty, December 2, 2018
Problem E. Easy Chess
Elma is learning chess gures.
She learned that a rook can move either horizontally or vertically. To enhance her understanding of rook
movement Elma's grandmother gave Elma an 8 × 8 chess board and asked her to nd a way to move
the rook from a1 to h8 making exactly n moves, so that all visited cells are di erent.
A visited cell is the initial cell a1 and each cell on which the rook lands after a move.
Input
The input contains a single integer n (2 ≤n ≤63) the desired number of moves.
Output
Output a space-separated list of n+1 visited cells in the order they are visited by the rook. All cells must
be di erent. The list should start with a1 and end with h8. A solution always exists.
Example
standard input standard output Illustration
4 a1 f1 c1 c8 h8
8
7
6
5
4
3
2
1
a b c d e f g h
Page 6 of 15