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;
typedef int ll;
vector<string> v(3);
string guess_sequence(int n) {
//{ CORRECTO
string s;
ll k1=press("AB");
if(k1>=1){
v[1]="X", v[2]="Y";
ll k2=press("A");
if(k2==1){
v[0]="B";
s="A";
}
else{
v[0]="A";
s="B";
}
}
else{
v[0]="A", v[1]="B";
ll k2=press("X");
if(k2==1){
v[2]="Y";
s="X";
}
else{
v[2]="X";
s="Y";
}
}
// CORRECTO }
if(n==1) return s;
if(n==2){
if(press(s+v[0])==2) return s+v[0];
else if(press(s+v[1])==2) return s+v[1];
else return s+v[2];
}
string p;
for(ll i=1; i<=n-2; i++){
p=s+v[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2];
ll k=press(p);
if(k==i+1){
s+=v[0];
}
else if(k==i+2){
s+=v[1];
}
else{
s+=v[2];
}
}
p=s+v[0];
ll l1=press(p);
if(l1==n) s+=v[0];
else{
p=s+v[1];
ll l2=press(p);
if(l2==n) s+=v[1];
else s+=v[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |