# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154666 | rama_pang | Combo (IOI18_combo) | C++14 | 56 ms | 568 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_sequence(int N) {
if (N == 1) {
if (press("A") == 1) return "A";
if (press("B") == 1) return "B";
if (press("X") == 1) return "X";
return "Y";
}
string cur = "";
int tmp;
tmp = press("AB");
if (tmp >= 1) {
tmp = press("A");
if (tmp == 1) cur = "A";
else cur = "B";
} else {
tmp = press("X");
if (tmp == 1) cur = "X";
else cur = "Y";
}
vector<char> ls;
if (cur[0] != 'A') ls.push_back('A');
if (cur[0] != 'B') ls.push_back('B');
if (cur[0] != 'X') ls.push_back('X');
if (cur[0] != 'Y') ls.push_back('Y');
while (cur.size() < N - 1) {
string guess;
guess = cur + ls[0] + cur + ls[1] + ls[0] + cur + ls[1] + ls[1] + cur + ls[1] + ls[2];
tmp = press(guess);
if (tmp == cur.size()) {
cur.push_back(ls[2]);
} else if (tmp == cur.size() + 1) {
cur.push_back(ls[0]);
} else {
cur.push_back(ls[1]);
}
}
tmp = press(cur + ls[0]);
if (tmp == N) {
cur.push_back(ls[0]);
} else {
tmp = press(cur + ls[1]);
if (tmp == N) cur.push_back(ls[1]);
else cur.push_back(ls[2]);
}
return cur;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |