#include using namespace std; #pragma GCC target("avx2") #pragma GCC opTimize("O3") #pragma GCC opTimize("unroll-loops") static const int STIME = clock(); static const int TIME_LIMIT = 1900; random_device rnd; mt19937 mt(rnd()); uniform_int_distribution<> rand2047(0, 2047); int A[2048][6]; int li[2048][2]; void calc_li() { for (int i = 0; i < 2048; ++i) { for (int j = 0; j < 3; ++j) { if (A[i][j+3] == 0) li[A[i][j]][0]++; if (A[i][j+3] == 1) li[A[i][j]][1]++; } } return; } vector make_ans_init() { vector ans(2048, -1); for (int i = 0; i < 2048; ++i) { bool flag = true; for (int j = 0; j < 3; ++j) { if (ans[A[i][j]] != -1) { flag = false; break; } } if (!flag) break; for (int j = 0; j < 3; ++j) { ans[A[i][j]] = A[i][j+3]; } } for (int i = 0; i < 2048; ++i) { if (ans[i] == -1) { if (li[i][0] < li[i][1]) { ans[i] = 1; } else{ ans[i] = 0; } } } return ans; } int eval_ans(vector &ans) { int ret = 0; for (int i = 0; i < 2048; ++i) { if (ans[A[i][0]] == A[i][3] && ans[A[i][1]] == A[i][4] && ans[A[i][2]] == A[i][3]) { ++ret; } } return ret; } vector make_ans_yama(vector ans) { for (int i = 0; i < 5; ++i) { int indx = rand2047(mt); ans[indx] = 1 - ans[indx]; } return ans; } void solve() { calc_li(); vector ans = make_ans_init(); int vestscore = eval_ans(ans); while (clock() - STIME < TIME_LIMIT) { vector nans = make_ans_yama(ans); int score = eval_ans(nans); if (score > vestscore) { vestscore = score; ans = nans; } } for (int i = 0; i < 2048; ++i) { cout << ans[2048-i-1]; } cout << "\n"; return; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); solve(); return 0; }