#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, i, j;
while(cin >> n && n > 0)
{
int a[n][n];
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
cin >> a[i][j];
}
}
int r1 = 0, c1 = 0;
vector<int>r, c;
for(i=0;i<n;i++)
{
int b = 0;
for(j=0;j<n;j++)
{
b += a[i][j];
}
if(b%2 == 1)
{
r.push_back(i);
r1++;
}
}
for(j=0;j<n;j++)
{
int b = 0;
for(i=0;i<n;i++)
{
b += a[i][j];
}
if(b%2 == 1)
{
c.push_back(j);
c1++;
}
}
if(r1 == 0 && c1 == 0)
{
cout << "OK" << endl;
}
else if(r1 == 1 && c1 == 1)
{
int x = r[0]+1, y = c[0]+1;
cout << "Change bit (" << x << "," << y << ")" << endl;
}
else
cout << "Corrupt" << endl;
}
return 0;
}
using namespace std;
int main()
{
int n, i, j;
while(cin >> n && n > 0)
{
int a[n][n];
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
cin >> a[i][j];
}
}
int r1 = 0, c1 = 0;
vector<int>r, c;
for(i=0;i<n;i++)
{
int b = 0;
for(j=0;j<n;j++)
{
b += a[i][j];
}
if(b%2 == 1)
{
r.push_back(i);
r1++;
}
}
for(j=0;j<n;j++)
{
int b = 0;
for(i=0;i<n;i++)
{
b += a[i][j];
}
if(b%2 == 1)
{
c.push_back(j);
c1++;
}
}
if(r1 == 0 && c1 == 0)
{
cout << "OK" << endl;
}
else if(r1 == 1 && c1 == 1)
{
int x = r[0]+1, y = c[0]+1;
cout << "Change bit (" << x << "," << y << ")" << endl;
}
else
cout << "Corrupt" << endl;
}
return 0;
}
Comments
Post a Comment