# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
863061 | maks007 | Combo (IOI18_combo) | C++14 | 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 "combo.h"
#include "bits/stdc++.h"
#include "grader.cpp"
using namespace std;
string guess_sequence(int n) {
string str = "", abxy;
str += 'A';
if(press(str) == 1) goto end;
str.pop_back();
str += 'B';
if(press(str) == 1) goto end;
str.pop_back();
str += 'X';
if(press(str) == 1) goto end;
str.pop_back();
str += 'Y';
end:;
if(str.size() == n) return str;
if(str[0] == 'X') abxy = "ABY";
else if(str[0] == 'A') abxy = "BXY";
else if(str[0] == 'Y') abxy = "ABX";
else abxy = "AXY";
while(1) {
for(int i = 0; i < abxy.size() - 1; i ++) {
str += abxy[i];
if(press(str) == str.size()) goto end2;
str.pop_back();
}
str += abxy.back();
end2:;
if(str.size() == n) return str;
}
}