using
System;
class
GFG {
public
static
int
minSwaps(
int
N,
int
M,
int
[,] A,
int
[,] B)
{
int
count01 = 0;
int
count10 = 0;
for
(
int
i = 0; i < N; i++) {
for
(
int
j = 0; j < M; j++) {
if
(A[i,j] != B[i, j]) {
if
(A[i, j] == 1)
count10++;
else
count01++;
}
}
}
if
(count01 == count10)
return
count01;
else
return
-1;
}
public
static
void
Main (String[] args)
{
int
[,] A = { { 1, 1, 0 }, { 0, 0, 1 }, { 0, 1, 0 } };
int
[,] B = { { 0, 0, 1 }, { 0, 1, 0 }, { 1, 1, 0 } };
int
N = A.GetLength(0);
int
M = 3;
Console.Write(minSwaps(N, M, A, B));
}
}