# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1052185 | khanhtb | 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>
#include "combo.h"
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define vi vector<ll>
#define vii vector<vi>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define all(a) a.begin(), a.end()
#define fi first
#define se second
using namespace std;
const ll mod = 1e9+7;
const ll inf = 2e18;
const ll B = 320;
const ll N = 1e5+8;
string ans = "";
int press(string p){
cout << p << '\n';
int rep; cin >> rep;
return rep;
}
vector<char> bt = {'A','B','X','Y'};
string guess_sequence(int N){
int fid = 0;
if(press("AB")){
if(press("A")) fid = 0;
else fid = 1;
}
else{
if(press("X")) fid = 2;
else fid = 3;
}
ans += bt[fid];
while(ans.size() < N){
int i1 = -1, i2 = -1, i3 = -1;
for(int i = 0; i < 4; i++){
if(i == fid) continue;
if(i1 == -1) i1 = i;
else if(i2 == -1) i2 = i;
else i3 = i;
}
int rep = press(ans + bt[i1] + bt[i2] + bt[i3] + ans + bt[i2] + bt[i3] + ans + bt[i3]);
if(rep == ans.size()+1) ans += bt[i3];
else if(rep == ans.size()+2) ans += bt[i2], ans += bt[i3];
else ans += bt[i1], ans += bt[i2], ans += bt[i3];
}
return ans;
}