# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
718804 | thimote75 | Combo (IOI18_combo) | C++14 | 34 ms | 576 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>
using namespace std;
string guess_start () {
if (press("AB") >= 1) {
if (press("A") == 1) return "A";
return "B";
}
if (press("X") == 1) return "X";
return "Y";
}
string state;
string start;
string h[3];
string H_map[] = { "A", "B", "X", "Y" };
void setup () {
int jH = 0;
for (int iH = 0; iH < 4; iH ++) {
if (H_map[iH] == start) continue ;
h[jH] = H_map[iH];
jH ++;
}
}
string get_next () {
string guess = state + h[0] + h[0]
+ state + h[0] + h[1]
+ state + h[0] + h[2]
+ state + h[1];
int res = press(guess);
if (res == state.size() + 2) return h[0];
if (res == state.size() + 1) return h[1];
return h[2];
}
string get_end (int N) {
if (press(state + h[0]) == N) return h[0];
if (press(state + h[1]) == N) return h[1];
return h[2];
}
string guess_sequence(int N) {
start = guess_start();
state = start;
setup();
for (int i = 1; i + 1 < N; i ++)
state += get_next();
if (N != 1)
state += get_end(N);
return state;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |