# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
728988 | Toxtaq | Combo (IOI18_combo) | C++17 | 1 ms | 208 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;
int press(std::string p);
std::string guess_sequence(int N){
int n = N;
string res = "", s;
if(press("A")){
res += 'A';
s = "BXY";
}
else if(press("B")){
res += 'B';
s = "AXY";
}
else if(press("X")){
res += 'X';
s = "ABY";
}
else{
res += 'Y';
s = "ABX";
}
for(int i = 1;i < n - 1;++i){
string d = res;
d += s[0];
d += res;
d += s[1];
d += s[0];
d += res;
d += s[1];
d += s[1];
d += res;
d += s[1];
d += s[2];
int num = press(d);
if(num == res.size() + 1){
res += s[0];
}
else if(num == res.size() + 2){
res += s[1];
}
else{
res += s[2];
}
}
string d = res;
d += s[0];
if(press(d) == n){
return d;
}
d.pop_back();
d += s[1];
if(press(d) == n){
return d;
}
d.pop_back();
d += s[2];
return d;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |