eolymp
bolt
Try our new interface for solving problems
Problems

Annealing peaceful queens!

Annealing peaceful queens!

\includegraphics{https://static.e-olymp.com/content/d6/d6434572c93f8b9066411ab58649881a44b2e5a7.jpg} Arrange \textbf{N} queens on a square \textbf{N}×\textbf{N} board, so that no two hit each other - a very difficult task. That's why it instructed you. \InputFile In a single input line is the number \textbf{4} ≤ \textbf{N} ≤ \textbf{200} - size board. \OutputFile Output of \textbf{N} numbers \textbf{a}: \textbf{a_i} - is the number of horizontal, on which you put the queen occupying the i-thuja vertical. Numbering of contours comes from the bottom up, from \textbf{1} to \textbf{N} (as in conventional chess board).
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
5
Output example #1
4 2 5 3 1