fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define sz 10010
  4. #define MOD 1000000007
  5. #define ll long long
  6.  
  7. bool check(vector<vector<int>>&a)
  8. {
  9. for (int i = 0; i < 3; i++)
  10. {
  11. for (int j = 0; j < 3; j++)
  12. {
  13. int ans = 0;
  14. for (int x = i; x < i + 2; x++)
  15. {
  16. for (int y = j; y < j + 2; y++)
  17. {
  18. ans += a[x][y];
  19. }
  20. }
  21. if (ans % 2 == 0)
  22. return 0;
  23. }
  24. }
  25. return 1;
  26. }
  27.  
  28. int main()
  29. {
  30. ios::sync_with_stdio(0);
  31. cin.tie(0); cout.tie(0);
  32. vector<vector<int>>mat = {{0, 0, 0, 0},
  33. {0, 0, 0, 0},
  34. {0, 0, 0, 0},
  35. {0, 0, 0, 0}
  36. };
  37.  
  38. set<vector<vector<int>>>ans;
  39.  
  40. for (int a = 0; a < 16; a++)
  41. {
  42. for (int b = 0; b < 16; b++)
  43. {
  44. for (int c = 0; c < 16; c++)
  45. {
  46. for (int d = 0; d < 16; d++)
  47. {
  48. mat[0][0] = (a >> 0) & 1;
  49. mat[0][1] = (a >> 1) & 1;
  50. mat[0][2] = (a >> 2) & 1;
  51. mat[0][3] = (a >> 3) & 1;
  52.  
  53. mat[1][0] = (b >> 0) & 1;
  54. mat[1][1] = (b >> 1) & 1;
  55. mat[1][2] = (b >> 2) & 1;
  56. mat[1][3] = (b >> 3) & 1;
  57.  
  58. mat[2][0] = (c >> 0) & 1;
  59. mat[2][1] = (c >> 1) & 1;
  60. mat[2][2] = (c >> 2) & 1;
  61. mat[2][3] = (c >> 3) & 1;
  62.  
  63. mat[3][0] = (d >> 0) & 1;
  64. mat[3][1] = (d >> 1) & 1;
  65. mat[3][2] = (d >> 2) & 1;
  66. mat[3][3] = (d >> 3) & 1;
  67.  
  68. if (check(mat))
  69. {
  70. ans.insert(mat);
  71. }
  72. }
  73. }
  74. }
  75. }
  76.  
  77. cout << ans.size() << endl;
  78. for (auto M : ans)
  79. {
  80. int v = 0;
  81. for (auto it : M)
  82. {
  83. for (auto it2 : it)
  84. {
  85. v += it2;
  86. cout << it2 << " ";
  87. }
  88. cout << endl;
  89. }
  90. // THIS LINE CONFIRMS THAT NONE OF THE ANSWERS HAVE
  91. // AN ODD NUMBER OF ONES
  92. assert(v % 2 == 0);
  93. cout << endl;
  94. }
  95. return 0;
  96. }
Success #stdin #stdout 0s 4448KB
stdin
Standard input is empty
stdout
128
0 0 0 0 
0 1 0 1 
0 0 0 0 
0 1 0 1 

0 0 0 0 
0 1 0 1 
0 0 0 0 
1 0 1 0 

0 0 0 0 
0 1 0 1 
1 1 1 1 
0 1 0 1 

0 0 0 0 
0 1 0 1 
1 1 1 1 
1 0 1 0 

0 0 0 0 
1 0 1 0 
0 0 0 0 
0 1 0 1 

0 0 0 0 
1 0 1 0 
0 0 0 0 
1 0 1 0 

0 0 0 0 
1 0 1 0 
1 1 1 1 
0 1 0 1 

0 0 0 0 
1 0 1 0 
1 1 1 1 
1 0 1 0 

0 0 0 1 
0 1 0 0 
0 0 0 1 
0 1 0 0 

0 0 0 1 
0 1 0 0 
0 0 0 1 
1 0 1 1 

0 0 0 1 
0 1 0 0 
1 1 1 0 
0 1 0 0 

0 0 0 1 
0 1 0 0 
1 1 1 0 
1 0 1 1 

0 0 0 1 
1 0 1 1 
0 0 0 1 
0 1 0 0 

0 0 0 1 
1 0 1 1 
0 0 0 1 
1 0 1 1 

0 0 0 1 
1 0 1 1 
1 1 1 0 
0 1 0 0 

0 0 0 1 
1 0 1 1 
1 1 1 0 
1 0 1 1 

0 0 1 0 
0 1 1 1 
0 0 1 0 
0 1 1 1 

0 0 1 0 
0 1 1 1 
0 0 1 0 
1 0 0 0 

0 0 1 0 
0 1 1 1 
1 1 0 1 
0 1 1 1 

0 0 1 0 
0 1 1 1 
1 1 0 1 
1 0 0 0 

0 0 1 0 
1 0 0 0 
0 0 1 0 
0 1 1 1 

0 0 1 0 
1 0 0 0 
0 0 1 0 
1 0 0 0 

0 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