Error
|
|
---|---|
@Ibrahim Nash | 5765 |
@blackshadows | 5715 |
@akhayrutdinov | 5111 |
@mb1973 | 4993 |
@Quandray | 4944 |
@saiujwal13083 | 4506 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3516 |
@sushant_a | 3459 |
@verma_ji | 3341 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@aroranayan999 | 1276 |
@bt8816103042 | 739 |
@rohitanand | 495 |
@codeantik | 479 |
@shalinibhataniya1097 | 472 |
@amrutakashikar2 | 464 |
@thealchemist627 | 456 |
@shivanandp12345678910 | 453 |
@dalwainazism125 | 453 |
@akashkale117 | 453 |
@SherlockHolmes3 | 447 |
Complete Leaderboard |
Given a matrix M[][], the task is to check if the sum of i-th row is equal to the sum of i-th column or not.
Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains two integers R and C and the second line contains R*C space separated matrix elements.
Output:
For each test case, if sums are equal for one or more rows and column, print "Yes" else print "No".
Constraints:
1<=T<=100
1<=R,C<=500
0<=M[][]<=103
Example:
Input:
2
4 4
1 2 3 4 9 5 3 1 0 3 5 6 0 4 5 6
3 3
1 2 3 1 2 3 1 1 3
Output:
Yes
No
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes