Bishops P93682


Statement
 

pdf   zip

html

You are given an n × n chess board, with some black bishops on it. Please place as many white bishops as possible is such a way that no white bishop threatens another bishop, either black or white.

For instance, for the board to the left a possible solution is shown on the board to the right.

boardfontsize=18pt showmover=false, label=false, maxfield=h8, setpieces=bc5,be7    showmover=false, label=false, maxfield=h8, setpieces=bc5,be7,Ba8,Bb8,Bc8,Be8,Bg8,Bh8,Ba5,Bh6,Bb1,Bd1,Bf1

Input

Input consists of several cases, each with n followed by n lines, each one with n characters: ‘B’ for black bishops, and ‘.’ for empty cells. Assume 1 ≤ n ≤ 1000.

Output

For every case, print any possible solution using ‘W’ for white bishops, followed by a line with 20 dashes. Follow exactly the format of the sample output.

Public test cases
  • Input

    8
    ........
    ....B...
    ........
    ..B.....
    ........
    ........
    ........
    ........
    
    3
    ...
    ...
    ...
    

    Output

    WWW.W.WW
    ....B...
    .......W
    W.B.....
    ........
    ........
    ........
    .W.W.W..
    --------------------
    WWW
    ...
    .W.
    --------------------
    
  • Information
    Author
    Felix Miravé
    Language
    English
    Official solutions
    C++
    User solutions
    C++