← Home
write a go solution for A. Binary Matrixtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputA matrix is called binary if all its elements are either 0 or 1.Ecrade calls a binary matrix A good if the following two properties hold:  The bitwise XOR of all numbers in each row of matrix A is equal to 0.  The bitwise XOR of all numbers in each column of matrix A is equal to 0. Ecrade has a binary matrix of size n*m. He is interested in the minimum number of elements that need to be changed for the matrix to become good.However, it seems a little difficult, so please help him!InputEach test contains multiple test cases. The first line contains the number of test cases t (1<=t<=400). The description of the test cases follows. The first line of each test case contains two integers n,m (1<=n,m<=100).This is followed by n lines, each containing exactly m characters consisting only of 0 and 1, describing the elements of Ecrade's matrix.It is guaranteed that the sum of n*m across all test cases does not exceed 5*10^4.OutputFor each test case, output a single integer, the minimum number of elements that need to be changed.ExampleInput73 30101010103 30000000003 31000100013 31010100003 30000100001 401014 10101Output2
0
3
3
1
2
2
NoteIn the first test case, he needs to change 2 elements to obtain the following matrix beginpmatrix1&1&01&0&10&1&1endpmatrix.In the second test case, he can make no changes to obtain the following matrix beginpmatrix0&0&00&0&00&0&0endpmatrix.In the third test case, he needs to change 3 elements to obtain the following matrix beginpmatrix1&0&10&0&01&0&1endpmatrix.. Output only the code with no comments, explanation, or additional text.