#include using namespace std; using ll = long long; constexpr int N = 2048, M = 256, K = 1; int a[N][6]; int main() { mt19937_64 rnd; int sc = 0; for (int k = 0; k < K; k++) { auto t0 = chrono::high_resolution_clock::now(); for (int i = 0; i < N; i++) { for (int h = 0; h < 6; h++) { if (K == 1) { cin >> a[i][h]; } else { a[i][h] = rnd() % (h < 3 ? 256 : 2); } } } array r = {}, t = {}; int s = 0; while (1) { for (int i = 0; i < N; i++) { int b = 0; for (int h = 0; h < 3; h++) { if (t[a[i][h]] == a[i][h + 3]) { b = 1; break; } } if (b == 0) { if (i > s) { s = i; r = t; } int h = rnd() % 3; t[a[i][h]] ^= 1; break; } } auto t1 = chrono::high_resolution_clock::now(); if (chrono::duration_cast(t1 - t0).count() >= 1000) break; } if (k == 0) { for (int j = M - 1; j >= 0; j--) { cout << (int)r[j]; } cout << endl; } if (K != 1) { int s = N; for (int i = 0; i < N; i++) { int b = 0; for (int h = 0; h < 3; h++) { if (r[a[i][h]] == a[i][h + 3]) { b = 1; break; } } if (b == 0) { s = i; break; } } cout << s << '\n'; sc += s; } } if (K != 1) { cout << sc * 100 / K << '\n'; } return 0; }