#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,a,b) for(i=a;i 1) { // if (binary_search(ALL(ans_group), "1234")) cerr << "1234 found" << endl; // dump(ans_group.size()); ll query_num = rand() % ans_group.size(); string query = ans_group[query_num]; ll x, y; rep(i, 3) cout << query[i] << " "; cout << query[i] << endl; cin >> x >> y; rep(i, ans_group.size()) { string target = ans_group[i]; bool erase = false; ll cnt1 = 0, cnt2 = 0; rep(j, 4) { if (target[j] == query[j]) cnt1++; } if (cnt1 < x) erase = true; rep(j, 4) rep(k, 4) { if (target[j] == query[k]) { cnt2++; break; } } if (cnt2 < x + y) erase = true; if (erase) { ans_group.erase(ans_group.begin() + i); i--; } } } rep(i, 3) cout << ans_group[0][i] << " "; cout << ans_group[0][i] << endl; return 0; }