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;
string guess_sequence(int N) {
string aux("ABXY");
string use="";
string S="";
int coins=0;
bool done=false;
for (int i=0; i<3; i++){
string gg;
gg.push_back(aux[i]);
coins=press(gg);
if (coins){
done=true;
S+=aux[i];
for(int j=0; j<4; j++) if (aux[j]!=aux[i]) use.push_back(aux[j]);
break;
}
}
if (!done){
S.push_back(aux[3]);
for(int j=0; j<3; j++) use.push_back(aux[j]);
coins=1;
}
while((int)S.size()!=N){
done=false;
for (int i=0; i<2; i++){
S+=use[i];
int ne=press(S);
if (ne==coins+1){
done=true;
coins=ne;
break;
}else S.pop_back();
}
if (!done){S.push_back(use[2]); coins++;}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |