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;
#define pb push_back
#define ff first
#define ss second
#define sz(a) (int)a.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const ll inf=1e18;
const int mod=1e9+7;
const int maxn=1e5;
string s;
vector<char>v;
//int press(string t){
// cout<<t<<'\n';
// int x; cin >> x;
// return x;
//}
string guess_sequence(int N){
int jog = press("AB");
if(jog==2) s+='A';
else if(jog==1){
if(press("A")==1) s += 'A';
else s += 'B';
}
else {
if(press("X")==1) s += 'X';
else s += 'Y';
}
if(s[0]=='A') v={'B','X','Y'};
else if(s[0]=='B') v={'A','X','Y'};
else if(s[0]=='X') v={'A','B','Y'};
else v={'A','B','X'};
for(int i = 1;i < N-1;i++){
string ask;
ask += s+v[0]+v[0];
ask += s+v[0]+v[1];
ask += s+v[0]+v[2];
ask += s+v[1];
int now=press(ask);
if(now==sz(s)+2) s+=v[0];
else if(now==sz(s)+1) s+=v[1];
else s+=v[2];
}
// cout<<s<<'\n';
if(press(s+v[0])==sz(s)+1) s += v[0];
else if(press(s+v[1])==sz(s)+1) s += v[1];
else s += v[2];
return s;
}
//int main(){
// cout << guess_sequence(3);
//}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |