# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
647930 | JANCARAPAN | Combo (IOI18_combo) | C++17 | 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"
using namespace std;
string ch = "ABXY";
string guess_sequence(int n) {
string s = "";
int block = -1;
if (press("A") == 1) block = 0;
else if (press("B") == 1) block = 1;
else if (press("X") == 1) block = 2;
else block = 3;
s += ch[block];
for (int i=1; i<n-1; i++) {
for (int j=0; j<4 && sz(s) < n; j++) {
if (block == j) continue;
if (press(s+ch[j]) > i) {
s += ch[j];
break;
}
}
}
return s;
}