当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2801:Clocks

题目描述
There are N clocks in the room. The clock is so weird that it has only four states: 3 o'clock, 6 o'clock, 9 o'clock, 12 o'clock, represented by 1,2,3,0.(i.e, state 1 means 3 o'clock, and so on). Now giving you the initial state of N clocks, and N operations you can use to make all the clocks into the state 12 o'clock. Each operation M[i](1<=i<=N) represents by a vector size of N, M[i][j] is 0 or 1. When you use operation M[i] on the N clocks, M[i][j] = 0 means the j-th clock will not make any change, M[i][j] = 1 means the j-th clock will turn into the next state (i.e, 3 o'clock --> 6 o'clock, 6 o'clock --> 9 o'clock, 9 o'clock -->12 o'clock, 12 o'clock -->3 o'clock). You should note that you can use each operation at most 3 times.
输入解释
Each test case contains a single integer N (1<=N<=50), indicating the number of clocks. The next following line contains N integers (each integer is in the range [0, 3]), meaning the initial state of N clocks. The next coming N lines each line contains N integers 0 or 1, each line describes an operation. The input is terminated by a set starting with N = 0.
输出解释
For each test case, If you can turn all the clocks into the state 12 o'clock, output "Yes", otherwise output "No".
输入样例
3
3 3 3
1 0 0
0 1 0
0 0 1
3
3 3 3
1 1 0
1 0 0
0 1 0
3
3 3 3
1 1 1
0 1 0
0 0 1
0
输出样例
Yes
No
Yes
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2801

最后修改于 2020-10-25T22:56:56+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)