codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1333A.md (1947B)


      1 Source: https://codeforces.com/problemset/problem/1333/A
      2 
      3 A. Little Artem
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Young boy Artem tries to paint a picture, and he asks his mother Medina to help him. Medina is very busy, that's why she asked for your help.
     22 
     23 Artem wants to paint an $n \times m$ board. Each cell of the board should be colored in white or black.
     24 
     25 Lets $B$ be the number of black cells that have at least one white neighbor adjacent by the side. Let $W$ be the number of white cells that have at least one black neighbor adjacent by the side. A coloring is called good if $B = W + 1$.
     26 
     27 The first coloring shown below has $B=5$ and $W=4$ (all cells have at least one neighbor with the opposite color). However, the second coloring is not good as it has $B=4$, $W=4$ (only the bottom right cell doesn't have a neighbor with the opposite color).
     28 
     29  ![](https://espresso.codeforces.com/6c0115fad7a6ab02f40802cf485c82184b58bea4.png) 
     30 
     31 Please, help Medina to find any good coloring. It's guaranteed that under given constraints the solution always exists. If there are several solutions, output any of them.
     32 
     33 Input
     34 
     35 Each test contains multiple test cases.
     36 
     37 The first line contains the number of test cases $t$ ($1 \le t \le 20$). Each of the next $t$ lines contains two integers $n, m$ ($2 \le n,m \le 100$) — the number of rows and the number of columns in the grid.
     38 
     39 Output
     40 
     41 For each test case print $n$ lines, each of length $m$, where $i$-th line is the $i$-th row of your colored matrix (cell labeled with 'B' means that the cell is black, and 'W' means white). Do not use quotes.
     42 
     43 It's guaranteed that under given constraints the solution always exists.
     44 
     45 Example
     46 
     47 Input
     48 
     49 ```
     50 2
     51 3 2
     52 3 3
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 BW
     59 WB
     60 BB
     61 BWB
     62 BWW
     63 BWB
     64 ```
     65 
     66 Note
     67 
     68 In the first testcase, $B=3$, $W=2$.
     69 
     70 In the second testcase, $B=5$, $W=4$. You can see the coloring in the statement.