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

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

Chess Positions

시간 제한1초메모리 제한256 MB

요약
각 테스트마다 8x8 체스판에 백색과 흑색 기물을 배치해 공격받는 백색 기물이 w개, 흑색 기물이 b개가 되도록 한다.
난이도

보통10점 중 5점

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

문제

You have an unlimited number of white and black chess pieces such as the queen, bishop, knight and rook. You are also given two numbers, ww and bb, the number of white and black pieces that must be under attack. It is required to create a position on the board 8×\times8 suitable for the restrictions described above.

The queen, the bishop and the rook move in the allowed direction before another figure is met and can attack if it is of a different color. The Knight also attacks a figure of a different color and and can jump over other pieces.

입력

First line contains integer tt --- number of tests. Next tt lines contain two integers ww and bb each --- number of white and black chess pieces under attack, correspondingly.

출력

For each test, you are required to output a chess position which satisfies given conditions. The position should be represented by 8 lines containing 8 symbols each. The positions should be split by an empty line. Empty cells should be printed as '.', cells containing queen should be represented as 'q', bishop cells -- 'b', knight cells -- 'k', and rook cells -- 'r'. White pieces should be printed in upper case and black ones in lower case. If there are multiple correct positions, you may print any of them. It is guaranteed that the correct answer always exists.

제한

  • 1≤t≤1031 \le t \le 10^3
  • 0≤w,b≤50 0 \le w, b \le 50
  • w+b≤64w + b \le 64

힌트

예제1

  1. 예제 1

    입력
    2
    2 3
    4 2
    
    예상 출력
    Q.b...rR
    ....K...
    ........
    .....b..
    ........
    ..k.....
    .k......
    ......Q.
    
    ........
    Q.k...Q.
    ........
    ...k....
    ..r..B..
    ....BkK.
    .....K..
    ..K.K...