codeforces-scrape

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

445A.md (1920B)


      1 Source: https://codeforces.com/problemset/problem/445/A
      2 
      3 A. DZY Loves Chessboard
      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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 DZY loves chessboard, and he enjoys playing with it.
     22 
     23 He has a chessboard of *n* rows and *m* columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white or black. After putting all chessmen, DZY wants that no two chessmen with the same color are on two adjacent cells. Two cells are adjacent if and only if they share a common edge.
     24 
     25 You task is to find any suitable placement of chessmen on the given chessboard.
     26 
     27 Input
     28 
     29 The first line contains two space-separated integers *n* and *m* (1 ≤ *n*, *m* ≤ 100).
     30 
     31 Each of the next *n* lines contains a string of *m* characters: the *j*-th character of the *i*-th string is either "." or "-". A "." means that the corresponding cell (in the *i*-th row and the *j*-th column) is good, while a "-" means it is bad.
     32 
     33 Output
     34 
     35 Output must contain *n* lines, each line must contain a string of *m* characters. The *j*-th character of the *i*-th string should be either "W", "B" or "-". Character "W" means the chessman on the cell is white, "B" means it is black, "-" means the cell is a bad cell.
     36 
     37 If multiple answers exist, print any of them. It is guaranteed that at least one answer exists.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 1 1  
     45 .
     46 ```
     47 
     48 Output
     49 
     50 ```
     51 B
     52 ```
     53 
     54 Input
     55 
     56 ```
     57 2 2  
     58 ..  
     59 ..
     60 ```
     61 
     62 Output
     63 
     64 ```
     65 BW  
     66 WB
     67 ```
     68 
     69 Input
     70 
     71 ```
     72 3 3  
     73 .-.  
     74 ---  
     75 --.
     76 ```
     77 
     78 Output
     79 
     80 ```
     81 B-B  
     82 ---  
     83 --B
     84 ```
     85 
     86 Note
     87 
     88 In the first sample, DZY puts a single black chessman. Of course putting a white one is also OK.
     89 
     90 In the second sample, all 4 cells are good. No two same chessmen share an edge in the sample output.
     91 
     92 In the third sample, no good cells are adjacent. So you can just put 3 chessmen, no matter what their colors are.