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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
//#define int ll
const ll mod=1e9+7;
string guess_sequence(int n){
string s=".";
vector<string> v={"A","B","X","Y"};
int x=3;
for(int i=0;i<3;i++){
int k=press(v[i]);
if(k==1){
s=v[i];
x=i;
break;
}
}
if(s==".") s=v[3];
vector<string> t;
for(int i=0;i<4;i++){
if(i!=x) t.pb(v[i]);
}
if(n==1) return s;
for(int i=1;i<n-1;i++){
string p=s+t[0];
for(int j=0;j<3;j++){
string k=s+t[1];
k+=t[j];
p+=k;
}
int N=(int) s.size();
int c=press(p);
if(c==N){
s+=t[2];
}else if(c==N+1) s+=t[0];
else s+=t[1];
}
if(n==2) return s;
for(int i=0;i<2;i++){
string p=s+t[i];
int c=press(p);
if(c==n){
s+=t[i];
break;
}
}
if((int) s.size() == n-1) s+=t[2];
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |