Century Matrix
Time Limit: 5 sec
Memory Limit: 256 MB
Attempts: 12
Accuracy: 0.00%
Author: Akashdeep Goel
Virat Kohli is fond of matrices. He has played a total of M*N matches so far and has kept record of all the scores in a score matrix of size M*N. He also loves to score a perfect hundred and calls a matrix a century matrix if all it's elements are 100. He wants to transform his score matrix to a century matrix of same size. To do this, he wants to performs a finite number of operations on his matrix. The single operation involves adding any integer to two adjacent cells in the matrix so as to try to convert it into century matrix. He is going to play in world cup and wants you to figure out if it is possible to transform his score matrix into century matrix.
Two cells are said to be adjacent if they share a common side.
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows:
The first line of each test case contains two integers M,N. Next M lines will contain N space-separated integers denoting the score of Virat Kohli.
Output
For each test case, print "YES" if transformation is possible, else print "NO". (without quotes)
Constraints
1 ≤ T ≤ 10
1 ≤ M,N ≤ 500
1 ≤ score ≤ 1000
Example
Input:
2
3 3
90 90 90
90 90 90
90 90 100
2 2
60 50
70 90
Output:
YES
NO
ID
SUBMITTED AT
STATUS
LANGUAGE
TIME
MEMORY USED
USER
TIME
STATUS
LANGUAGE
TIME
MEMORY USED
4 months ago
cpp
0.07 sec
64 KB
4 months ago
cpp
0.07 sec
64 KB
4 months ago
cpp
0.07 sec
64 KB
2 years ago
java
0.12 sec
428 KB
2 years ago
java
0.18 sec
428 KB
2 years ago
cpp14
0.07 sec
64 KB
2 years ago
cpp14
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.00 sec
0 KB