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 ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define ld long double
#define S second
using namespace std;
const ll N = 5e3 + 5;
const ll NN = 4e5 + 5;
const ll INF = 1e18;
const ll inf = 1e9;
const ll MOD = 1e9 + 7;
char a[10];
int was[10];
int press(std::string p);
string guess_sequence(int n){
a[1] = 'A';
a[2] = 'B';
a[3] = 'X';
a[4] = 'Y';
string s = "";
s = "ABX";
if(press("ABX")==0){
s = "Y";
a[1] = 'A';
a[2] = 'B';
a[3] = 'X';
}
else if(press("ABY") == 0){
s = "X";
a[1] = 'A';
a[2] = 'B';
a[3] = 'Y';
}
else if(press("AXY") == 0){
s = "B";
a[1] = 'A';
a[2] = 'Y';
a[3] = 'X';
}
else{
s = "A";
a[1] = 'Y';
a[2] = 'B';
a[3] = 'X';
}
for(int i = 2;i <= n;i++){
string d = s;
d += a[1];
d += a[2];
int z = press(d);
z -= int(s.size());
d = s;
d += a[1];
d += a[1];
int x= press(d);
x -= int(s.size());
if(z == 0){
s += a[3];
continue;
}
else if(z == 1 && x == 0){
s += a[2];
}
else{
s += a[1];
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |