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>
#define pii pair<int,int>
#define iii pair<int,pii>
#define fi first
#define se second
#define vi vector<int>
#define all(x) x.begin(),x.end()
#define TEXT "a"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int inf = 1e9 + 7;
const ld eps = 1e-8;
const double pi = acos(-1);
string ch[4] = {"A","B","X","Y"};
string guess_sequence(int n){
string s = "";
int f = -1;
int g = press(s + ch[0] + ch[1]);
if (g == 0){
g = press(s + ch[2]);
if (g == 0) f = 3;
else f = 2;
}
else{
g = press(s + ch[0]);
if (g == 0) f = 1;
else f = 0;
}
s += ch[f];
vector<string> a;
for (int i = 0; i < 4; i++){
if (i == f) continue;
a.push_back(ch[i]);
}
string g1,g2,g3;
g1 = a[1] + a[0];
g2 = a[1] + a[1];
g3 = a[1] + a[2];
for (int i = 2; i < n; i++){
int g = press(s + a[0] + s + g1 + s + g2 + s + g3);
int t = s.size();
if (g == 0 + t) s += a[2];
if (g == 1 + t) s += a[0];
if (g == 2 + t) s += a[1];
}
if (n == 1) return s;
int t = s.size();
g = press(s + a[0]);
if (g == t){
g = press(s + a[1]);
if (g == t) s += a[2];
else s += a[1];
}
else s += a[0];
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |