Guest User

Untitled

a guest
Feb 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll ;
  4. typedef unsigned long long ull ;
  5. #define pb push_back
  6. #define all(v) (v).begin(), (v).end()
  7. #define mp make_pair
  8. #define rep(i,a,b) for (int i = a; i < b; i++)
  9. #define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  10. void time ()
  11. {
  12. cout<<endl<<"Clock ticks: "<<clock()<<" Seconds: "<<(double)clock()/CLOCKS_PER_SEC*1000;
  13. }
  14. //-std=c++0x
  15.  
  16. int main() {
  17.  
  18. int n ;
  19. while (cin >> n && n)
  20. {
  21. int arr[n][n] ;
  22. int rows[n] ;
  23. int colos [n] ;
  24. int cnt = 0 ;
  25. vector <int> vi , vj ;
  26.  
  27. memset(rows,0,sizeof rows);
  28. memset(colos,0,sizeof colos);
  29.  
  30. rep(i,0,n)
  31. {
  32. rep(j,0,n)
  33. {
  34. cin >> arr[i][j];
  35. rows[i]+=arr[i][j];
  36. colos[j]+= arr[i][j];
  37. }
  38. if ( rows[i] %2 == 1) { cnt ++ ; vj.pb(i) ; }
  39. }
  40.  
  41. rep(i,0,n)
  42. {
  43. if (colos[i]%2 ==1) { cnt++ ; vi.pb(i) ; }
  44. }
  45. if (cnt == 0) cout <<"OK"<<endl;
  46. else if ( cnt == 2 &&vi.size() && vj.size())
  47. {
  48. cout <<"Change bit "<<'('<<vj[0]+1<<','<<vi[0]+1<<')'<<endl;
  49. } else cout <<"Corrupt"<<endl;
  50. }
  51. return 0;
  52. }
Add Comment
Please, Sign In to add comment