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"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;
const ll maxn=2e5+5;
#define ok ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define endl '\n'
string ans;
char c;
string guess_sequence(int n) {
if(press("XY")) {
if(press("X")) c='X';
else c='Y';
} else if(press("A")) {
c='A';
} else {
c='B';
}
ans.pb(c);
if(n==1) return ans;
for(int i=1; i<=n-2; i++) {
if(c=='X') {
int cur=press(ans+"YA"+ans+"YB"+ans+"YY"+ans+"A");
if(cur==i+2) ans.pb('Y');
else if(cur==i+1) ans.pb('A');
else ans.pb('B');
} else if(c=='Y') {
int cur=press(ans+"XA"+ans+"XB"+ans+"XX"+ans+"A");
if(cur==i+2) ans.pb('X');
else if(cur==i+1) ans.pb('A');
else ans.pb('B');
} else if(c=='A') {
int cur=press(ans+"YB"+ans+"YX"+ans+"YY"+ans+"X");
if(cur==i+2) ans.pb('Y');
else if(cur==i+1) ans.pb('X');
else ans.pb('B');
} else {
int cur=press(ans+"YA"+ans+"YX"+ans+"YY"+ans+"X");
if(cur==i+2) ans.pb('Y');
else if(cur==i+1) ans.pb('X');
else ans.pb('A');
}
}
if(c=='X') {
if(press(ans+"Y")==n) ans.pb('Y');
else if(press(ans+"A")==n) ans.pb('A');
else ans.pb('B');
} else if(c=='Y') {
if(press(ans+"X")==n) ans.pb('X');
else if(press(ans+"A")==n) ans.pb('A');
else ans.pb('B');
} else if(c=='A') {
if(press(ans+"Y")==n) ans.pb('Y');
else if(press(ans+"X")==n) ans.pb('X');
else ans.pb('B');
} else {
if(press(ans+"Y")==n) ans.pb('Y');
else if(press(ans+"A")==n) ans.pb('A');
else ans.pb('X');
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |