# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165501 | qwerty234 | Combo (IOI18_combo) | C++14 | 47 ms | 820 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>
#define ll long long
#define ull unsigned ll
#define ld long double
#define pll pair<ll, ll>
#define pii pair<int, int>
#define f first
#define se second
#define pb push_back
#define ft fflush(stdout)
using namespace std;
const int N = 4e5 + 123;
const int PLS = 3e5 + 123;
string guess_sequence(int n) {
int ans;
vector <string> psb;
psb.clear();
string cur = "";
ans = press("AB");
if (ans == 2) {
cur = "A";
psb.pb("B");
psb.pb("X");
psb.pb("Y");
} else if (ans == 1) {
ans = press("A");
if (ans == 1) {
cur = "A";
psb.pb("B");
psb.pb("X");
psb.pb("Y");
} else {
cur = "B";
psb.pb("A");
psb.pb("X");
psb.pb("Y");
}
} else {
ans = press("X");
if (ans == 1) {
cur = "X";
psb.pb("A");
psb.pb("B");
psb.pb("Y");
} else {
cur = "Y";
psb.pb("A");
psb.pb("B");
psb.pb("X");
}
}
string t1, t2, t3, t4;
t1 = psb[0];
t2 = psb[1] + psb[0];
t3 = psb[1] + psb[1];
t4 = psb[1] + psb[2];
for (int i = 2; i <= n - 1; i++) {
ans = press(cur + t1 + cur + t2 + cur + t3 + cur + t4);
if (ans == cur.size()) {
cur += psb[2];
} else if (ans == cur.size() + 1) {
cur += psb[0];
} else {
cur += psb[1];
}
}
if (n != 1) {
ans = press(cur + psb[0]);
if (ans == cur.size() + 1) {
cur += psb[0];
} else {
ans = press(cur + psb[1]);
if (ans == cur.size() + 1)
cur += psb[1];
else
cur += psb[2];
}
}
return cur;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |