# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1008375 | HappyCapybara | 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>
using namespace std;
string guess_sequence(int N){
string s;
if (press("AB")){
if (press("A")) s = "A";
else s = "B";
}
else {
if (press("X")) s = "X";
else s = "Y";
}
vector<string> v;
for (string x : {"A", "B", "X", "Y"}) if (s != x) v.push_back(x);
while (s.size() < N-1){
string p;
p += s;
p += v[0];
for (int i=0; i<3; i++){
p += s;
p += v[1];
p += v[i];
}
int res = press(p);
if (res == s.size()+1) s += v[0];
else if (res == s.size()+2) s += v[1];
else s += v[2];
}
if (press(s+v[0]) == N) return s+v[0];
if (press(s+v[1]) == N) return s+v[1];
else return s+v[2];
}