eolymp
bolt
Try our new interface for solving problems
Problems

Drunk King

Drunk King

Drunk king is a piece which moves as a usual chess king (i. e. to one of eight adjacent cells), but cannot make two consecutive moves in the same direction. Drunk king stands in an upper-left corner of an \textbf{N}×\textbf{M} chessboard and wants to visit each cell exactly once and return to initial position. His path must have no self-intersections. Here are the examples of correct tours: \includegraphics{https://static.e-olymp.com/content/59/59a5f0b46826b59ae9d839540c58d0c1f4fb1375.jpg} Help the king to find the required tour. \InputFile The only input line contains \textbf{2} integers: \textbf{N} and \textbf{M} (\textbf{2} ≤ \textbf{N}, \textbf{M} ≤ \textbf{500}). \OutputFile In the first line output \textbf{Yes} or \textbf{No} depending on whether the required tour exists. If the tour exists, output it in the next \textbf{2N-1} lines with symbols "\textbf{o}" (code \textbf{111}), "\textbf{|}" (code \textbf{124}), "\textbf{-}" (code \textbf{45}), "\textbf{/}" (код \textbf{47}), "\textbf{\textbackslash}" (code \textbf{92}) and spaces. Each of these lines should contain exactly \textbf{2M-1} symbols. Use the format shown in the sample below. If there are many tours, you can output any of them.
Time limit 1 second
Memory limit 64 MiB
Author Igor Chevdar