# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
220007 | Basilhijaz | Combo (IOI18_combo) | C++14 | 38 ms | 552 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 <combo.h>
using namespace std;
string guess_sequence(int N) {
string p = "";
string ans = "";
string ABX = "";
int a = press("AB");
int b = press("AX");
if(a && b){
ans += 'A';
ABX = "BXY";
}
else if(a && !b){
ans += 'B';
ABX = "AXY";
}
else if(!a && b){
ans += 'X';
ABX = "ABY";
}
else{
ans += 'Y';
ABX = "ABX";
}
for(int i = 0; i < N - 2; i++){
p = "";
p += ans;
p += ABX[0];
p += ans;
p += ABX[1];
p += ABX[1];
p += ans;
p += ABX[1];
p += ABX[0];
p += ans;
p += ABX[1];
p += ABX[2];
int num = press(p);
if(num == i + 1){
ans += ABX[2];
}
else if(num == i + 2){
ans += ABX[0];
}
else{
ans += ABX[1];
}
}
bool ok = 1;
if(ans.size() == N) return ans;
for(int i = 0; i < 2; i++){
p = "";
p += ans;
p += ABX[i];
if(press(p) == N && ok){
ans += ABX[i];
ok = 0;
break;
}
}
if(ok){
ans += ABX[2];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |