A8899 | IQ Test
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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.
输出格式
Print "YES" (without the quotes), if the test can be passed and "NO" (without the quotes) otherwise.
输入输出样例
输入 #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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted