# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
885789 | sq00 | 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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string buttons = "", firstBtn = "";
if(press("A") == 1) {
firstBtn = "A";
buttons = "BYX";
}
else if(press("B") == 1) {
firstBtn = "B";
buttons = "AYX";
}
else if(press("Y") == 1) {
firstBtn = "Y";
buttons = "ABX";
}
else if(press("X") == 1) {
firstBtn = "X";
buttons = "ABY";
}
string current = firstBtn;
while(true) {
for(int i = 0; i < buttons.size(); i++) {
string test = current + buttons[i];
int cost = press(test);
if(cost == test.size()) {
current = test;
break;
}
if(i == 1) current += buttons[2];
}
if(current.size() == n) break;
}
return current;
}