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 speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=2e5+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
//
//int press(string s) {
// cout<<s<<"\n"<<flush;
// int x;
// cin>>x;
// return x;
//}
string guess_sequence(int N) {
string now;
string a,b,c,d;
if (press("AB")!=0) {
if (press("A")) a="A",b="B",c="X",d="Y";
else a="B",b="A",c="X",d="Y";
} else {
if (press("X")) a="X",b="B",c="A",d="Y";
else a="Y",b="A",c="B",d="X";
}
if (N==1) return a;
now=a;
for (int i=1;i<N-1;i++) {
// cout<<i<<" i\n"<<flush;
string q=now+b+b+now+b+c+now+b+d+now+c;
int ans=press(q);
if (ans==i) now+=d;
else if (ans==i+1) now+=c;
else now+=b;
}
string q=now+b;
if (press(q)==N) return q;
q=now+c;
if (press(q)==N) return q;
return now+d;
}
//int main() {
// speed;
// guess_sequence(5);
// return 0;
//}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |