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;
std::string guess_sequence(int N) {
string b="";
b.push_back('A');b.push_back('B');b.push_back('X');b.push_back('Y');
string S="";string p="";int t;
for(int i=0;i<3;i++){
p.push_back(b[i]);
t=press(p);
if(t){
S.push_back(b[i]);
b.erase(b.begin()+i);
break;
}
p.clear();
}
int g=S.size();
if(!g){
S.push_back(b[3]);
b.erase(b.begin()+3);
}
for(int j=0;j<N-1;j++){
for(int i=0;i<2;i++){
p=S;
p.push_back(b[i]);
t=press(p);
if(t==j+2){
S.push_back(b[i]);
}
}
g=S.size();
if(g!=j+2){
S.push_back(b[2]);
}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |