# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
254937 | jainbot27 | 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;
#define nl endl
// int press(string x){
// cout << x << endl;
// int n;
// cin >> n;
// return n;
// }
string t[] = {"A", "B", "X", "Y"};
string guess_sequence(int n){
string ret;
string f="";
if(press("AB")){
if(press("A")) f += "A";
else f+= "B";
}
else{
if(press("X")) f += "X";
else f+="Y";
}
vector<string> want;
for(int i = 0; i < 4; i++){
if(t[i] != f){
want.push_back(t[i]);
}
}
ret = f;
for(int i = 2; i < n; i++){
string query = "";
query += ret + want[0] + ret + want[1] + want[0] + ret + want[1] + want[2] + ret + want[1] + want[1] + ret + want[2];
int res = press(query);
if(res == (int)ret.size()) ret += want[2];
else if(res == (int)ret.size() + 1) ret += want[0];
else ret += want[1];
}
if(press(ret + want[0])==n) ret += want[0];
else if(press(ret + want[1]) == n) ret += want[1];
else ret += want[2];
return ret;
}
// int main(){
// guess_sequence(69);
/