CF1742C.Stripes
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
On an 8×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.
在一个 8×8 的网格中,某些水平行被涂成红色,某些垂直列被涂成蓝色,涂色以某种顺序依次进行。每次涂色时,该条纹会重绘其经过的所有格子。
请判断最后使用的是哪种颜色。
红色条纹是在蓝色条纹之后绘制的,因此答案是 R。
输入格式
The first line of the input contains a single integer t (1≤t≤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 8 lines, each containing 8 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.
输入的第一行包含一个整数 t(1≤t≤4000),表示测试用例的数量。随后是各测试用例的描述。每个测试用例之前均有一空行。
每个测试用例由 8 行组成,每行包含 8 个字符。这些字符只能是 'R'、'B' 或 '.',分别表示红色方格、蓝色方格和未涂色方格。
保证所给棋盘是由一个全白(未涂色)棋盘通过绘制若干水平的红色行与若干垂直的蓝色列得到的。
至少有一条条纹被涂色。
输出格式
For each test case, output 'R' if a red stripe was painted last, and 'B' if a blue stripe was painted last (without quotes).
对于每个测试用例,如果最后绘制的是红色条纹,则输出 R;如果最后绘制的是蓝色条纹,则输出 B(不带引号)。
输入输出样例
输入#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.
第一个测试用例如题面图示所示。
在第二个测试用例中,首先绘制第一个蓝色列,然后绘制第一行和最后一行红色行,最后绘制最后一个蓝色列。由于最后绘制的是蓝色条纹,因此答案为 B。
输入解题思路,AI测评打分。不知道怎么写?