# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154062 | nthoang | Combo (IOI18_combo) | C++11 | 1 ms | 256 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>
#ifndef LOCAL
#include "combo.h"
#endif
#ifdef LOCAL
#include "/Users/nth842002/Library/debug.h"
int press(string p) { }
int main() { }
#endif
using namespace std;
const string moves = "ABXY";
string guess_sequence(int n) {
srand(time(0));
string s;
s.resize(n);
for (int i = 0; i < 4; i++) {
string t;
t += moves[i];
if (press(t) == 1) {
s[0] = moves[i];
break;
}
}
string avail;
for (int i = 0; i < 4; i++) {
if (moves[i] != s[0]) {
avail += moves[i];
}
}
string cur;
cur += s[0];
for (int i = 1; i < n; i++) {
random_shuffle(avail.begin(), avail.end());
for (int j = 0; j < 2; j++) {
cur += avail[j];
if (press(cur) == i + 1) {
break;
}
cur.pop_back();
}
if (cur.length() == i) {
cur += avail[2];
}
}
assert(s.length() == n);
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |