ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

Ural SU contest. Petrozavodsk training camp. Summer 2008

About     Problems     Submit solution     Judge status     Standings
Contest is over

E. Drunk King

Time limit: 1.0 second
Memory limit: 64 MB
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 N × 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:
Problem illustration
Help the king to find the required tour.

Input

The only input line contains 2 integers: N and M (2 ≤ N, M ≤ 500).

Output

In the first line output “Yes” or “No” depending on whether the required tour exists. If the tour exists, output it in the next 2N − 1 lines with symbols “o” (ASCII code 111), “|” (code 124), “-” (code 45), “/” (code 47), “\” (code 92) and spaces. Each of these lines should contain exactly 2M − 1 symbols. Use the format shown in the sample below. If there are many tours, you can output any of them.

Samples

inputoutput
6 8
Yes
o-o o-o o-o o-o
|  \| |/  |/  |
o-o o o o o o-o
  |    / \   \ 
o-o o-o o-o o-o
|    \   \   \ 
o-o o-o o-o o-o
  |  \   \   \ 
o-o o o o-o o o
|  /| | |  /| |
o-o o-o o-o o-o
5 5
No
Problem Author: Igor Chevdar
Problem Source: Ural SU Contest. Petrozavodsk Summer Session, August 2008
To submit the solution for this problem go to the Problem set: 1674. Drunk King