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"
//#include "grader.cpp"
using namespace std;
string K="ABXY",letters="";
string guess_sequence(int N) {
string ans="";
int x = press("AB");
if(x){
x=press("A");
if(x)ans = "A";
else ans = "B";
}
else{
x=press("X");
if(x)ans = "X";
else ans = "Y";
}
if(N == 1)return ans;
for(auto pp:K){
if(pp != ans[0])
letters += pp;
}
string t1,t2,t3,t4;
int n=N;
for(int i=1;i<n-1;i++){
t1=t2=t3= ans + letters[0];
t1+=letters[0];
t2+=letters[1];
t3+=letters[2];
t4=ans;
t4+=letters[1];
// cout<<t1<<t2<<t3<<t4<<endl;
int x=press(t1+t2+t3+t4);
if(x == i){
ans += letters[2];
}
else if(x == i + 1){
ans += letters[1];
}
else ans += letters[0];
}
// cout<<ans<<endl;
// cout<< ans<<endl;
x=press(ans + letters[0]);
if(x == n) return ans + letters[0];
x = press(ans + letters[1]);
if(x == n) return ans + letters[1];
return ans + letters[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |