CF1742C.Stripes

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

On an 8×88 \times 8 grid, some horizontal rows have been painted red, and some vertical columns have been painted blue, in some order. The stripes are drawn sequentially, one after the other. When the stripe is drawn, it repaints all the cells through which it passes.

Determine which color was used last.

The red stripe was painted after the blue one, so the answer is R.

输入格式

The first line of the input contains a single integer tt ( 1t40001 \leq t \leq 4000 ) — the number of test cases. The description of test cases follows. There is an empty line before each test case.

Each test case consists of 88 lines, each containing 88 characters. Each of these characters is either 'R', 'B', or '.', denoting a red square, a blue square, and an unpainted square, respectively.

It is guaranteed that the given field is obtained from a colorless one by drawing horizontal red rows and vertical blue columns.

At least one stripe is painted.

输出格式

For each test case, output 'R' if a red stripe was painted last, and 'B' if a blue stripe was painted last (without quotes).

输入输出样例

  • 输入#1

    4
    
    
    ....B...
    ....B...
    ....B...
    RRRRRRRR
    ....B...
    ....B...
    ....B...
    ....B...
    
    
    RRRRRRRB
    B......B
    B......B
    B......B
    B......B
    B......B
    B......B
    RRRRRRRB
    
    
    RRRRRRBB
    .B.B..BB
    RRRRRRBB
    .B.B..BB
    .B.B..BB
    RRRRRRBB
    .B.B..BB
    .B.B..BB
    
    
    ........
    ........
    ........
    RRRRRRRR
    ........
    ........
    ........
    ........

    输出#1

    R
    B
    B
    R

说明/提示

The first test case is pictured in the statement.

In the second test case, the first blue column is painted first, then the first and last red rows, and finally the last blue column. Since a blue stripe is painted last, the answer is B.

首页