# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
885791 | sq00 | Combo (IOI18_combo) | C++14 | 1 ms | 344 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 < (int)buttons.size() - 1; 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;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |