#P7049. [NWRRC2015] Black and White

[NWRRC2015] Black and White

题目描述

The jury has a great artistic idea -- to create a rectangular panel out of a huge pile of black and white squares of the same size. The panel should have exactly b4connectedb 4-connected areas made of black tiles, and w4connectedw 4-connected areas made of white tiles.

Remember, a 4connected4-connected area of some color is a maximal set of the panel tiles such that:

any two tiles of the area share the same color;

for any two tiles of the area there is a tile sequence connecting them, such that any two consecutive tiles of the sequence share a common side.

In addition to the artistic idea, the jury has already developed a program that produces design of the panel. But since this problem is about art, any new solution is extremely important for the jury.

输入格式

The only line of the input file contains two integers bb and ww -- number of black and white areas (1b,w1000)(1 \le b , w \le 1000) .

输出格式

The first line of the output file should contain the picture sizes rr and cc -- the number of rows and columns (1r,c100000)(1 \le r , c \le 100 000) . This line should be followed by rr lines of cc symbols each. Each symbol should be either @‘@' (for black tile) or .‘. ' (for white one). There should be no more than 100000100 000 tiles in the panel.

题目大意

给定正整数 b,wb,w,请你构造出一个黑白矩阵,使得矩阵内恰有 bb 个黑色连通块和 ww 个白色连通块。

输出的第一行包含两个整数 r,cr,c,表示你构造出的矩阵的行数和列数。接下来是一个 r×cr\times c 的矩阵,表示你构造出的黑白矩阵。其中 @ 代表黑色,. 代表白色。

数据范围:1b,w10001\le b,w\le 1000

你的矩阵应满足:1r,c1000001\le r,c\le 100000r×c100000r\times c\le100000

2 3

6 7
@@@@@@@
@.@@@@@
@@...@@
@@@@@@@
.......
@@@@@@@

提示

Time limit: 2 s, Memory limit: 256 MB.