Advertisement
Nickpips

Untitled

Jan 18th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <fstream>
  4. #include <math.h>
  5. #include <vector>
  6. #include <bitset>
  7. #include <string>
  8. #include <stack>
  9. #include <queue>
  10. #include <map>
  11. #include <set>
  12.  
  13. #define _CRT_SECURE_NO_DEPRECATE
  14.  
  15. using namespace std;
  16.  
  17. typedef long long ll;
  18. typedef vector<int> vi;
  19. typedef vector<vi> vi2;
  20. typedef pair<int, int> ii;
  21. typedef vector<ii> vii;
  22.  
  23. #define FOR(i, a, b) \
  24. for (int i = int(a); i < int(b); i++)
  25. #define FORi(i, c) \
  26. for (auto i = (c).begin(); i != (c).end(); i++)
  27.  
  28. string name = "nums";
  29.  
  30. ifstream in( name+".in" );
  31. ofstream out( name+".out" );
  32.  
  33. int main()
  34. {
  35. vector<vi2> successes;
  36.  
  37. vi2 m( 16, vi( 5, 0 ) );
  38.  
  39. m[0][2] = m[9][1] = 1;
  40. m[1][3] = m[10][2] = 1;
  41. m[2][1] = m[8][4] = 1;
  42. m[3][3] = m[11][4] = 1;
  43. m[7][3] = m[15][4] = 1;
  44.  
  45. vi2 bytes( 16, vi( 5, 0 ) );
  46. for( int I = 0; I < 16; I++ )
  47. {
  48. int i = I;
  49. bytes[I][1] = i % 2;
  50. i >>= 1;
  51. bytes[I][2] = i % 2;
  52. i >>= 1;
  53. bytes[I][3] = i % 2;
  54. i >>= 1;
  55. bytes[I][4] = i % 2;
  56. }
  57.  
  58. for( int I = 0; I < 1048576; I++ )
  59. {
  60. if( I % 10485 == 0 )
  61. cout << I/10485 << "% Complete" << endl;
  62.  
  63. int tmp = I;
  64. m[0][1] = m[8][2] = tmp % 2;
  65. tmp >>= 1;
  66. m[0][4] = m[11][1] = tmp % 2;
  67. tmp >>= 1;
  68. m[1][2] = m[9][2] = tmp % 2;
  69. tmp >>= 1;
  70. m[1][4] = m[11][2] = tmp % 2;
  71. tmp >>= 1;
  72. m[2][2] = m[9][3] = tmp % 2;
  73. tmp >>= 1;
  74. m[2][3] = m[10][3] = tmp % 2;
  75. tmp >>= 1;
  76. m[3][2] = m[10][4] = tmp % 2;
  77. tmp >>= 1;
  78. m[3][4] = m[12][1] = tmp % 2;
  79. tmp >>= 1;
  80. m[4][1] = m[12][2] = tmp % 2;
  81. tmp >>= 1;
  82. m[4][3] = m[14][1] = tmp % 2;
  83. tmp >>= 1;
  84. m[4][4] = m[15][1] = tmp % 2;
  85. tmp >>= 1;
  86. m[5][1] = m[12][3] = tmp % 2;
  87. tmp >>= 1;
  88. m[5][2] = m[13][2] = tmp % 2;
  89. tmp >>= 1;
  90. m[5][3] = m[14][2] = tmp % 2;
  91. tmp >>= 1;
  92. m[6][2] = m[13][3] = tmp % 2;
  93. tmp >>= 1;
  94. m[6][3] = m[14][3] = tmp % 2;
  95. tmp >>= 1;
  96. m[6][4] = m[15][3] = tmp % 2;
  97. tmp >>= 1;
  98. m[7][1] = m[13][4] = tmp % 2;
  99. tmp >>= 1;
  100. m[7][2] = m[14][4] = tmp % 2;
  101. tmp >>= 1;
  102. m[7][4] = tmp % 2;
  103.  
  104. bool success = true;
  105. for( int i = 0; i < 16; i++ )
  106. {
  107. bool found = false;
  108. for( int j = 0; j < 16; j++ )
  109. {
  110. if( bytes[i] == m[j] )
  111. {
  112. found = true;
  113. break;
  114. }
  115. }
  116. if( found == false )
  117. {
  118. success = false;
  119. break;
  120. }
  121. }
  122. if( success )
  123. {
  124. cout << "FOUND: " << endl;
  125. for( vi k : m )
  126. cout << k[1] << " " << k[2] << " " << k[3] << " " << k[4] << endl;
  127. successes.push_back( m );
  128. }
  129. }
  130.  
  131. cout << "DONE" << endl;
  132. cin.get();
  133.  
  134. in.close();
  135. out.close();
  136. return 0;
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement