# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
636985 | bonk | Combo (IOI18_combo) | C++14 | 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>
using namespace std;
string guess_sequence(int n){
char fi = ' ';
if(press("A")) fi = 'A';
else if(press("B")) fi = 'B';
else if(press("X")) fi = 'X';
else fi = 'Y';
string ans = "";
ans += fi;
int len = 1;
while(len < n){
if(fi != 'A' && (press(ans + 'A')) == len + 1) ans += 'A';
else if(fi != 'B' && (press(ans + 'B')) == len + 1) ans += 'B';
else if(fi != 'X' && (press(ans + 'X')) == len + 1) ans += 'X';
else ans += 'Y';
len++;
}
return ans;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n; cin >> n;
cout << guess_sequence(n) << '\n';
return 0;
}