Print the fixed 101-column black and white grid whose isolated single tiles yield exactly b black areas and w white areas.
Easy2ImplementationMatrixNo attempts yetTime limit2sMemory limit256 MBYou build a rectangular panel out of black and white square tiles of the same size. The finished panel must contain exactly b 4-connected areas of black tiles and exactly w 4-connected areas of white tiles.
A 4-connected area of one color is a maximal set of tiles that satisfies both conditions below.
Many panels meet these counts, so only the panel fixed by the output rule below is accepted.
The first line contains the number of black areas b and the number of white areas w. (1≤b,w≤1000)
Print the number of rows r and the number of columns c of the panel on the first line, then print r lines of c characters each. A black tile is @ and a white tile is ..
The accepted panel is fixed by the rule below. Rows and columns are numbered from 1.
@. For each i=1,2,…,p, change the tile in row 2⌈i/50⌉ and column 2(((i−1)mod50)+1) to .... For each j=1,2,…,q, change the tile in row h1+2⌈j/50⌉ and column 2(((j−1)mod50)+1) to @.