# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580493 | Vanilla | Combo (IOI18_combo) | C++17 | 42 ms | 588 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 ord = "ABXY";
string guess_sequence(int N) {
int a1 = press("AB");
int fr = 0;
if (a1 == 0) {
fr = 2;
int a2 = press("X");
if (!a2) fr = 3;
}
else if (a1 == 1) {
int a2 = press("A");
if (!a2) fr = 1;
}
if (fr == 1) ord = "BXYA";
else if (fr == 2) ord = "XYAB";
else if (fr == 3) ord = "YABX";
string rs = "";
rs.push_back(ord[0]);
if (N == 1) return rs;
if (N == 2) {
if (press(rs + ord[1]) == 2) rs+=ord[1];
else if (press(rs + ord[2]) == 2) rs+=ord[2];
else rs+=ord[3];
return rs;
}
for (int i = 1; i < N - 1; i++){
string nw = rs + ord[1] + rs + ord[2] + ord[1] + rs + ord[2] + ord[2] + rs + ord[2] + ord[3];
assert(nw.size() <= 4 * N);
int now = press(nw);
if (now == rs.size() + 1) {
rs+=ord[1];
}
else if (now == rs.size() + 2) {
rs+=ord[2];
}
else {
rs+=ord[3];
}
}
if (press(rs + ord[1]) == N){
if (press(rs + ord[2] + ord[1] + rs + ord[2] + ord[2] + rs + ord[2] + ord[3]) == N) rs.push_back(ord[2]);
else rs.push_back(ord[1]);
}
else {
if (press(rs + ord[2] + ord[1] + rs + ord[2] + ord[2] + rs + ord[2] + ord[3]) == N) rs.push_back(ord[2]);
else rs.push_back(ord[3]);
}
// cout << rs << "\n";
return rs;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |