# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123780 | mlyean00 | Combo (IOI18_combo) | C++14 | 43 ms | 456 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;
string moves = "ABXY";
int N;
string s;
void get_first() {
for (char c : moves) {
if (press(string(1, c)) == 1) {
s = c;
break;
}
}
moves.erase(moves.find(s[0]), 1);
}
void get_next() {
string p = s + moves[0];
for (char c : moves) {
p += s;
p.push_back(moves[1]);
p.push_back(c);
}
switch (press(p) - s.size()) {
case 0:
s.push_back(moves[2]);
break;
case 1:
s.push_back(moves[0]);
break;
case 2:
s.push_back(moves[1]);
break;
}
}
void get_last() {
for (char c : moves) {
if (press(s + c) > s.size()) {
s += c;
return;
}
}
}
string guess_sequence(int n) {
int N = n;
get_first();
for (int i = 1; i < N - 1; ++i)
get_next();
if (N > 1) get_last();
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |