Submit | All submissions | Best solutions | Back to list |
TRIZ - Triple Zeros |
Given an N by M matrix of zeros and ones check if there are 3 vertically contiguous zeros or not.
i.e.
0 0 1 0 1 0 1 0 0 0 1 0
The bold zeros represent three zeros vertically contiguous (there are 2 triplets.)
Input
First line contains N and M (1 <= N, M <= 5) number of rows and number of columns of the matrix.
N lines follows each line contains M digits (either 0 or 1) separated by a space.
Output
Prints one line containing a "Yes" if there are three zeros vertically contiguous or "No" otherwise.
Example
Input: 5 5 1 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 Output: Yes
Added by: | Omar ElAzazy |
Date: | 2012-03-14 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
2013-12-31 15:02:14 Samil Vargas
Weak testcase :C but great problem defenetly a good tutorial |