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;
string aux(string k, string ca){
string ka=k;
string k1=k;
ka+=ca[0];
ka+=k;
ka+=ca[1];
ka+=ca[0];
ka+=k;
ka+=ca[1];
ka+=ca[1];
ka+=k;
ka+=ca[1];
ka+=ca[2];
int res=press(ka);
res-= (int)k.size();
if(res == 2){
k1+=ca[1];
}else if(res == 1){
k1+=ca[0];
}else{
k1+=ca[2];
}
return k1;
}
string guess_sequence(int N){
string ans="AB";
string k="";
if(press(ans) == 1){
ans="A";
if(press(ans) == 1){
k="A";
}else{
k="B";
}
}else{
ans="X";
if(press(ans) == 1){
k="X";
}else{
k="Y";
}
}
char car= k[0];
string c="ABXY";
string ca="aaa";
int j=0;
for(int i=0; i<4; i++){
if(c[i]==car){
continue;
}else{
ca[j]=c[i];
j++;
}
}
for(int i=1; i<N-1; i++){
k=aux(k,ca);
}
ans=k;
string k1=k;
k1+=ca[0];
k1+=k;
k1+=ca[1];
if(press(k1) == (int)k.size() +1){
k1=k;
k1+=ca[0];
if(press(k1) == (int)k.size() +1){
ans=k1;
}else{
ans+=ca[1];
}
}else{
ans+=ca[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |