405155: GYM101807 G Go

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Gotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

One day, GFRIEND members went to a Go club to perform their song and learn how to play Go.

[video]output.mp4[/video]

To teach them the basic rules of Go, the master gave them $$$N$$$ white stones and $$$M$$$ black stones. He then ask them to use the white stones to surround the black stones on the standard 19x19 Go board. The arrangement must satisfy the followings:

  • They must use all $$$N$$$ white stones and all $$$M$$$ black stones.
  • All black stones must be "captured". In order to capture a group of black stones, it must be surrounded by white stones in all 4 directions without gaps and spaces.
  • Though it is not necessary for the black stones to form a single group, all white stones must be necessary, i.e. removing any one white stone will cause at least one black stone not being captured.

The above rules can also be expressed by the followings:

  • The 19x19 board must contain exactly $$$N$$$ white stones and exactly $$$M$$$ black stones.
  • Each white stone must be directly adjacent to (4 directions) at least 1 black stone.
  • Each black stone must be directly adjacent to (4 directions) 4 black or white stones.

Help GFRIEND by writing a program to find out if there is a possible arrangement, and if there is, output any one.

Input

The input consists of 2 integers $$$N$$$ and $$$M$$$.

$$$1 \le N, M \le 80$$$.

Output

If there is no possible arrangement that satisfies the rules, output Impossible.

Otherwise, output a 19x19 grid that contains any valid arrangement. Use . to represent empty space, o to represent white stone and x to represent black stone.

ExamplesInput
20 25
Output
...................
...................
...................
...................
...................
...................
...................
...................
...................
...................
..........ooooo....
.........oxxxxxo...
.........oxxxxxo...
.........oxxxxxo...
.........oxxxxxo...
.........oxxxxxo...
..........ooooo....
...................
...................
Input
21 10
Output
...................
...................
...................
...ooo.............
..oxxxo............
...ooxo............
.....o.............
.........o..o......
........oxooxo.....
........oxxxxo.....
.........oooo......
...................
...................
...................
...................
...................
...................
...................
...................
Input
5 2
Output
Impossible

加入题单

上一题 下一题 算法标签: