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 = "";
string t = "";
t = s + ch[0] + ch[1];
int f = -1;
int g = press(t);
if (g == 0){
t = s + ch[2];
g = press(t);
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<int> a;
for (int i = 0; i < 4; i++){
if (i == f) continue;
a.push_back(i);
}
string g1,g2,g3;
g1 = g2 = g3 = "";
g1 += ch[a[1]] + ch[a[0]];
g2 += ch[a[1]] + ch[a[1]];
g3 += ch[a[1]] + ch[a[2]];
for (int i = 2; i < n; i++){
int g = press(s + ch[a[0]] + s + g1 + s + g2 + s + g3);
if (g == 0) s += ch[a[2]];
if (g == 1) s += ch[a[0]];
if (g == 2) s += ch[a[1]];
}
g = press(s + ch[a[0]]);
if (g == 0){
g = press(s + ch[a[1]]);
if (g == 0) s += ch[a[2]];
else s += ch[a[1]];
}
else s += ch[a[0]];
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |