Checkerboard
题号:NC224870
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

An r × c grid of squares is to be colored in a checkerboard style. The board will be filled with rectangles made up of the grid squares. The heights and widths of the rectangles will be specified. Black and White are the only two colors of the rectangles. Any two adjacent rectangles that share a side should be colored differently. The top-left rectangle should be Black. Print the checkerboard.

输入描述:

The first line contains four space-separated integers r, c, v and h (1 ≤ v ≤ r ≤ 50, 1 ≤ h ≤ c ≤ 50) where the checkerboard is to have r rows and c columns, with v rectangles vertically and h rectangles horizontally.

Each of the next v lines contain a single positive integer a. The sum of the a values will be exactly r. These are the heights of the v rectangles in each column, in order from top to bottom.

Each of the next h lines contain a single positive integer b. The sum of the b values will be exactly c. These are the widths of the h rectangles in each row, in order from left to right.

输出描述:

Print the described checkerboard, in the form of r strings of length c, one per line. The strings should only contain the characters upper-case B (for a Black square) and upper-case W (for a White square).
示例1

输入

复制
6 5 3 2
1
2
3
3
2

输出

复制
BBBWW
WWWBB
WWWBB
BBBWW
BBBWW
BBBWW
示例2

输入

复制
4 4 2 2
1
3
3
1

输出

复制
BBBW
WWWB
WWWB
WWWB