아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Build The Grid

시간 제한2초메모리 제한1024 MB

요약
흰 칸이 하나로 연결되고 모든 검은 칸이 흰 칸과 변을 맞대며, 각 행과 열의 검은 칸 수가 0부터 N-1의 순열이 되도록 N×N 격자를 만든다.
난이도

보통10점 중 6점

유형
구현, 그리디, 시뮬레이션, 수학
정답자
아직 제출이 없습니다

문제

Given is a square grid of N×NN \times N squares. Your task is to paint each square of the grid either white or black such that:

  • The white squares are connected: for any two white squares, you can go from one to the other by moving only between white squares that share a side.
  • Each black square shares a side with at least one white square.
  • Denote the number of black cells in the ii-th row as p_ip\_i. The sequence P=(p_1,p_2,…,p_N)P = (p\_1, p\_2, \ldots, p\_N) is then a permutation of integers between 00 and N−1N-1, inclusive.
  • Denote the number of black cells in the jj-th column as q_jq\_j. The sequence Q=(q_1,q_2,…,q_N)Q = (q\_1, q\_2, \ldots, q\_N) is then a permutation of integers between 00 and N−1N-1, inclusive.

It can be shown that such a construction always exists.

입력

The input consists of one integer NN (2≤N≤5002 \le N \le 500).

출력

Print NN lines. On the ii-th line, print a string of length NN consisting of characters 'B' and 'W'. The jj-th character in the ii-th string corresponds to the square in ii-th row and jj-th column: 'B' denotes black squares and 'W' denotes white squares.

예제1

  1. 예제 1

    입력
    3
    
    예상 출력
    WWB
    BWB
    WWW