# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
552267 | lethinh05 | Combo (IOI18_combo) | C++11 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define oo 1000000007
#define ll long long
#define ld long double
#define ii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define mp make_pair
#define vi vector<int>
#define vii vector<ii>
#define sz(a) (int)(a.size())
#define pb push_back
#define fto(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define fdto(i, a, b) for (int i = (int)(a); i >= (int)(b); --i)
#define bug(x) "["#x" = "<<(x)<<"] "
#define maxN 100005
using namespace std;
char chrs[] = {'A', 'B', 'X', 'Y'};
#ifdef LOCALME
int press(string p) {
cout << p << "\n";
fflush(stdout);
int x; cin >> x;
return x;
}
#endif // LOCALME
string guess_sequence(int n) {
string s = "";
fto(i, 0, 3) {
string p(n, chrs[i]);
int matches = press(p);
if (matches == 1) {
s += chrs[i];
break;
}
}
fto(i, 1, n-1) {
fto(i, 0, 3) {
string p = s + chrs[i];
int matches = press(p);
if (matches == sz(p)) {
s += chrs[i];
break;
}
}
}
return s;
}
int main() {
#ifdef LOCALME
int n; cin >> n;
string res = guess_sequence(n);
cout << res << "\n";
#endif
return 0;
}