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;
char c[4]={'A','B','X','Y'};
string guess_sequence(int N)
{
int koji=0;
string s1="XY",s2="BY";
if(press(s1)) koji+=2;
if(press(s2)) koji+=1;
string s="";
s+=c[koji];
vector<char> ch;
for(int i=0;i<4;i++) if(i!=koji) ch.push_back(c[i]);
if(N==1) return s;
for(int i=2;i<N;i++)
{
string t=s+ch[0]+s+ch[1]+ch[0]+s+ch[1]+ch[1]+s+ch[1]+ch[2];
int x=press(t);
if(x==i-1) s+=ch[2];
if(x==i+0) s+=ch[0];
if(x==i+1) s+=ch[1];
}
string t1=s+ch[0],t2=s+ch[1],t3=s+ch[2];
if(press(t1)==N) return t1;
if(press(t2)==N) return t2;
return t3;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |