/***
Md. Nazmul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<cstring>
#include<sstream>
#include<cmath>
#include <iomanip>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ;
#define new_line pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647
int main()
{
int n,x,y,num,row_odd,col_odd,r,c;
int data[105][105],row[105],col[105];
memset(row,0,sizeof(row));
memset(col,0,sizeof(col));
while(sc("%d",&n) &&n)
{
memset(row,0,sizeof(row));
memset(col,0,sizeof(col));
for(int i=0 ; i<n ; i++)
for(int j=0 ; j<n ; j++)
{
sc("%d",&data[i][j]);
row[i] = row[i]+data[i][j];
col[j] = col[j] + data[i][j];
}
row_odd = col_odd = 0;
for(int i=0 ; i<n ; i++)
{
if(row[i]%2)
row_odd++;
if(col[i]%2)
col_odd++;
for(int j=0 ; j<n ; j++)
if(row[i]%2 && col[j]%2)
{
r=i+1;
c = j+1;
}
}
if(row_odd>1 || col_odd>1)
pf("Corrupt\n");
else if(row_odd==0 && col_odd ==0)
pf("OK\n");
else if(row_odd==1 && col_odd==1)
pf("Change bit (%d,%d)\n",r,c);
}
return 0;
}
Md. Nazmul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<cstring>
#include<sstream>
#include<cmath>
#include <iomanip>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ;
#define new_line pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647
int main()
{
int n,x,y,num,row_odd,col_odd,r,c;
int data[105][105],row[105],col[105];
memset(row,0,sizeof(row));
memset(col,0,sizeof(col));
while(sc("%d",&n) &&n)
{
memset(row,0,sizeof(row));
memset(col,0,sizeof(col));
for(int i=0 ; i<n ; i++)
for(int j=0 ; j<n ; j++)
{
sc("%d",&data[i][j]);
row[i] = row[i]+data[i][j];
col[j] = col[j] + data[i][j];
}
row_odd = col_odd = 0;
for(int i=0 ; i<n ; i++)
{
if(row[i]%2)
row_odd++;
if(col[i]%2)
col_odd++;
for(int j=0 ; j<n ; j++)
if(row[i]%2 && col[j]%2)
{
r=i+1;
c = j+1;
}
}
if(row_odd>1 || col_odd>1)
pf("Corrupt\n");
else if(row_odd==0 && col_odd ==0)
pf("OK\n");
else if(row_odd==1 && col_odd==1)
pf("Change bit (%d,%d)\n",r,c);
}
return 0;
}
No comments:
Post a Comment