# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
897372 | honanhphong | Combo (IOI18_combo) | C++14 | 12 ms | 1912 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>
#define pb push_back
#define fi first
#define se second
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
using lli = long long;
using ld = long double;
using pii = pair <int, int>;
mt19937_64 Rand(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 1e6 + 1000;
const int mod = 1e9 + 7;
int press(string p);
string guess_sequence(int N)
{
string s = "";
char cs[maxn];
if(press("AB")){
if(press("A"))
s = "A";
else s = "B";
}
else{
if(press("X"))
s = "X";
else s = "Y";
}
if (s == "A")
{
cs[0] = 'B'; cs[1] = 'X'; cs[2] = 'Y';
} else if (s == "B")
{
cs[0] = 'A'; cs[1] = 'X'; cs[2] = 'Y';
} else if (s == "X")
{
cs[0] = 'A'; cs[1] = 'B'; cs[2] = 'Y';
} else
{
cs[0] = 'A'; cs[1] = 'B'; cs[2] = 'X';
}
for (lli i = 0; i < N - 2; i ++)
{
lli guess = press(s + cs[0] + cs[0] + s + cs[0] + cs[1] + s + cs[0] + cs[2] + s + cs[1]);
if (guess == s.size() + 2) s += cs[0];
else if (guess == s.size() + 1) s += cs[1];
else s += cs[2];
}
if (N <= 1) return s;
if (press(s + cs[0]) == N) return s + cs[0];
else if (press(s + cs[1]) == N) return s + cs[1];
else return s + cs[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |