# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875048 | amin_2008 | Combo (IOI18_combo) | C++17 | 13 ms | 1844 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;
#define REP(i,n) for(int i=0;i<(n);++i)
const int M = 4;
const char LET[] = "ABXY";
int guess_one(const string& s) {
int len = press(s + LET[0] + s + LET[1]);
int idx = 2*(len < s.length()+1);
len = press(s + LET[idx]);
idx += (len < s.length()+1);
return idx;
}
string guess_sequence(int N) {
int idx[M];
REP(i, M) { idx[i] = i; }
string s;
{
int id = guess_one(s);
s += LET[id];
swap(idx[id], idx[M-1]);
}
REP(i, N-2) {
string z;
REP(j, M-1) {
z += s + LET[idx[0]] + LET[idx[j]];
}
z += s + LET[idx[1]];
int len = press(z);
if (len == i+3) {
s += LET[idx[0]];
} else if (len == i+2) {
s += LET[idx[1]];
} else {
s += LET[idx[2]];
}
}
if (N > 1) {
int id = guess_one(s);
s += LET[id];
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |