Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll ;
- typedef unsigned long long ull ;
- #define pb push_back
- #define all(v) (v).begin(), (v).end()
- #define mp make_pair
- #define rep(i,a,b) for (int i = a; i < b; i++)
- #define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- void time ()
- {
- cout<<endl<<"Clock ticks: "<<clock()<<" Seconds: "<<(double)clock()/CLOCKS_PER_SEC*1000;
- }
- //-std=c++0x
- int main() {
- int n ;
- while (cin >> n && n)
- {
- int arr[n][n] ;
- int rows[n] ;
- int colos [n] ;
- int cnt = 0 ;
- vector <int> vi , vj ;
- memset(rows,0,sizeof rows);
- memset(colos,0,sizeof colos);
- rep(i,0,n)
- {
- rep(j,0,n)
- {
- cin >> arr[i][j];
- rows[i]+=arr[i][j];
- colos[j]+= arr[i][j];
- }
- if ( rows[i] %2 == 1) { cnt ++ ; vj.pb(i) ; }
- }
- rep(i,0,n)
- {
- if (colos[i]%2 ==1) { cnt++ ; vi.pb(i) ; }
- }
- if (cnt == 0) cout <<"OK"<<endl;
- else if ( cnt == 2 &&vi.size() && vj.size())
- {
- cout <<"Change bit "<<'('<<vj[0]+1<<','<<vi[0]+1<<')'<<endl;
- } else cout <<"Corrupt"<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment