CF287A.IQ Test
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In the city of Ultima Thule job applicants are often offered an IQ test.
The test is as follows: the person gets a piece of squared paper with a 4 × 4 square painted on it. Some of the square's cells are painted black and others are painted white. Your task is to repaint at most one cell the other color so that the picture has a 2 × 2 square, completely consisting of cells of the same color. If the initial picture already has such a square, the person should just say so and the test will be completed.
Your task is to write a program that determines whether it is possible to pass the test. You cannot pass the test if either repainting any cell or no action doesn't result in a 2 × 2 square, consisting of cells of the same color.
在乌尔蒂玛·图勒城,求职者经常会被要求参加一项智商测试。
测试内容如下:应试者会得到一张画有 4×4 方格的方格纸。该方格中部分单元格被涂成黑色,其余被涂成白色。你的任务是:最多将一个单元格的颜色翻转(即黑变白或白变黑),使得整个图案中存在一个 2×2 的子方块,其全部四个单元格颜色相同。如果初始图案中已经存在这样的 2×2 同色子方块,则应试者只需指出这一点,测试即告完成。
你的任务是编写一个程序,判断是否能够通过该测试。当且仅当无论是否翻转任意一个单元格,都无法得到一个全部由同色单元格组成的 2×2 子方块时,才视为无法通过测试。
输入格式
Four lines contain four characters each: the j-th character of the i-th line equals "." if the cell in the i-th row and the j-th column of the square is painted white, and "#", if the cell is black.
四行,每行包含四个字符:第 i 行的第 j 个字符为 “.”,表示方格中第 i 行、第 j 列的格子被涂成白色;若为 “#”,则表示该格子被涂成黑色。
输出格式
Print "YES" (without the quotes), if the test can be passed and "NO" (without the quotes) otherwise.
如果可以通过测试,则输出 "YES"(不带引号);否则输出 "NO"(不带引号)。
输入输出样例
输入#1
#### .#.. #### ....
输出#1
YES
输入#2
#### .... #### ....
输出#2
NO
说明/提示
In the first test sample it is enough to repaint the first cell in the second row. After such repainting the required 2 × 2 square is on the intersection of the 1-st and 2-nd row with the 1-st and 2-nd column.
在第一个测试样例中,只需重绘第二行的第一个单元格。完成该重绘后,所需的 2×2 正方形位于第 1 行与第 2 行、第 1 列与第 2 列的交集处。
输入解题思路,AI测评打分。不知道怎么写?