# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975279 | ShaShi | Combo (IOI18_combo) | C++17 | 1 ms | 600 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 F first
#define S second
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
const int MAX = (int)2e3 + 7;
const int MOD = 998244353;
const int INF = (int)1e9 + 7;
string guess_sequence(int N) {
string res, s, op;
res = "";
int x = press("AB");
if (x) {
x = press("A");
if (x) res.pb('A');
else res.pb('B');
} else {
x = press("X");
if (x) res.pb('X');
else res.pb('Y');
}
s = "";
if (res[0] != 'A') s.pb('A');
if (res[0] != 'B') s.pb('B');
if (res[0] != 'X') s.pb('X');
if (res[0] != 'Y') s.pb('Y');
while (res.size() != N-1) {
op.clear();
op.pb(res[0]); op.pb(s[0]);
op.pb(res[0]); op.pb(s[1]); op.pb(s[0]);
op.pb(res[0]); op.pb(s[1]); op.pb(s[1]);
op.pb(res[0]); op.pb(s[1]); op.pb(s[2]);
x = press(op);
if (x == res.size()) {
res.pb(s[2]);
} else if (x == res.size()+1) {
res.pb(s[0]);
} else {
res.pb(s[1]);
}
}
res.pb(s[0]);
x = press(res);
if (x == N) return res;
res.pop_back(); res.pb(s[1]);
x = press(res);
if (x == N) return res;
res.pop_back(); res.pb(s[2]);
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |