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 push_top(string &s, char c){
reverse(s.begin(),s.end());
s.push_back(c);
reverse(s.begin(),s.end());
return s;
}
string pop_top(string &s){
reverse(s.begin(),s.end());
s.pop_back();
reverse(s.begin(),s.end());
return s;
}
string guess_sequence(int n) {
char c[]={'A','B','X','Y'};
string s;
while(1){
if((int)s.size()==n) break;
bool f=0;
for(int i=0; i<4; i++){
s.push_back(c[i]);
if(press(s)==(int)s.size()){
f=1;
break;
}else s.pop_back();
}
if(!f) break;
}
while(1){
if((int)s.size()==n) break;
bool f=0;
for(int i=0; i<4; i++){
s=push_top(s,c[i]);
if(press(s)==(int)s.size()){
f=1;
break;
}else s=pop_top(s);
}
if(!f) break;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |