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 N 100009
#define pii pair <int, int>
#define ff first
#define sz() size()
#define ss second
#define pb push_back
#define ll long long
using namespace std;
char c[5]={'X', 'Y', 'A', 'B'};
string a;
/*
int press(string ss){
cout<<ss<<'\n';
int y;
cin>>y;
return y;
}
*/
string guess_sequence(int n){
string s;
int in=-1;
s+="AB";
int x=press(s);
if(x){
s='A';
in=3;
x=press(s);
if(x)
in=2;
}
else{
s='X';
in=1;
x=press(s);
if(x)
in=0;
}
s=c[in];
swap(c[in], c[3]);
for(int i=1; i<n-1; i++){
a=s+c[0]+s+c[1]+c[0]+s+c[1]+c[1]+s+c[1]+c[2];
x=press(a);
if(x==i+1)
s+=c[0];
else if(x==i+2)
s+=c[1];
else
s+=c[2];
}
a=s+c[0];
x=press(a);
if(x==n)
return a;
a=s+c[1];
x=press(a);
if(x==n)
return a;
s+c[2];
return s;
}
/*
int main(){
int n;
cin>>n;
cout<<guess_sequence(n);
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |