Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <fstream>
- #include <math.h>
- #include <vector>
- #include <bitset>
- #include <string>
- #include <stack>
- #include <queue>
- #include <map>
- #include <set>
- #define _CRT_SECURE_NO_DEPRECATE
- using namespace std;
- typedef long long ll;
- typedef vector<int> vi;
- typedef vector<vi> vi2;
- typedef pair<int, int> ii;
- typedef vector<ii> vii;
- #define FOR(i, a, b) \
- for (int i = int(a); i < int(b); i++)
- #define FORi(i, c) \
- for (auto i = (c).begin(); i != (c).end(); i++)
- string name = "nums";
- ifstream in( name+".in" );
- ofstream out( name+".out" );
- int main()
- {
- vector<vi2> successes;
- vi2 m( 16, vi( 5, 0 ) );
- m[0][2] = m[9][1] = 1;
- m[1][3] = m[10][2] = 1;
- m[2][1] = m[8][4] = 1;
- m[3][3] = m[11][4] = 1;
- m[7][3] = m[15][4] = 1;
- vi2 bytes( 16, vi( 5, 0 ) );
- for( int I = 0; I < 16; I++ )
- {
- int i = I;
- bytes[I][1] = i % 2;
- i >>= 1;
- bytes[I][2] = i % 2;
- i >>= 1;
- bytes[I][3] = i % 2;
- i >>= 1;
- bytes[I][4] = i % 2;
- }
- for( int I = 0; I < 1048576; I++ )
- {
- if( I % 10485 == 0 )
- cout << I/10485 << "% Complete" << endl;
- int tmp = I;
- m[0][1] = m[8][2] = tmp % 2;
- tmp >>= 1;
- m[0][4] = m[11][1] = tmp % 2;
- tmp >>= 1;
- m[1][2] = m[9][2] = tmp % 2;
- tmp >>= 1;
- m[1][4] = m[11][2] = tmp % 2;
- tmp >>= 1;
- m[2][2] = m[9][3] = tmp % 2;
- tmp >>= 1;
- m[2][3] = m[10][3] = tmp % 2;
- tmp >>= 1;
- m[3][2] = m[10][4] = tmp % 2;
- tmp >>= 1;
- m[3][4] = m[12][1] = tmp % 2;
- tmp >>= 1;
- m[4][1] = m[12][2] = tmp % 2;
- tmp >>= 1;
- m[4][3] = m[14][1] = tmp % 2;
- tmp >>= 1;
- m[4][4] = m[15][1] = tmp % 2;
- tmp >>= 1;
- m[5][1] = m[12][3] = tmp % 2;
- tmp >>= 1;
- m[5][2] = m[13][2] = tmp % 2;
- tmp >>= 1;
- m[5][3] = m[14][2] = tmp % 2;
- tmp >>= 1;
- m[6][2] = m[13][3] = tmp % 2;
- tmp >>= 1;
- m[6][3] = m[14][3] = tmp % 2;
- tmp >>= 1;
- m[6][4] = m[15][3] = tmp % 2;
- tmp >>= 1;
- m[7][1] = m[13][4] = tmp % 2;
- tmp >>= 1;
- m[7][2] = m[14][4] = tmp % 2;
- tmp >>= 1;
- m[7][4] = tmp % 2;
- bool success = true;
- for( int i = 0; i < 16; i++ )
- {
- bool found = false;
- for( int j = 0; j < 16; j++ )
- {
- if( bytes[i] == m[j] )
- {
- found = true;
- break;
- }
- }
- if( found == false )
- {
- success = false;
- break;
- }
- }
- if( success )
- {
- cout << "FOUND: " << endl;
- for( vi k : m )
- cout << k[1] << " " << k[2] << " " << k[3] << " " << k[4] << endl;
- successes.push_back( m );
- }
- }
- cout << "DONE" << endl;
- cin.get();
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement