# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
369142 | wind_reaper | Combo (IOI18_combo) | C++17 | 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"
using namespace std;
/*int press(string s){
cout << "query : " << s << endl;
int r;
cin >> r;
return r;
}*/
string string_guess(int N){
string ans;
vector<string> s = {"A", "B", "X", "Y"};
bool f = false;
for(int i = 0; i < 3 && !f; i++){
if(press(s[i]) == 1){
ans += s[i];
s.erase(s.begin() + i);
f = true;
}
}
if(!f){
ans += 'Y';
s.erase(s.begin() + 3);
}
for(int i = 1; i < N-1; i++){
string query = ans + s[0] + ans + s[1] + s[0] + ans + s[1] + s[1] + ans + s[1] + s[2];
int r = press(query);
if(r == ans.size() + 1){
ans += s[0];
continue;
}
if(r == ans.size() + 2){
ans += s[1];
continue;
}
if(r == ans.size()){
ans += s[2];
continue;
}
}
f = false;
for(int i = 0; i < 2 && !f; i++){
if(press(ans + s[i]) == N){
ans += s[i];
f = true;
}
}
if(!f){
ans += s[2];
}
return ans;
}
/*int32_t main(){
// ios_base::sync_with_stdio(false);
// cin.tie(NULL);
int n;
cin >> n;
cout << string_guess(n) << '\n';
return 0;
}*/