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 guess_sequence(int n) {
string p="AB";
vector<char> a={'A', 'B', 'X', 'Y'};
string S, curr;
vector<char> let;
if(!press("AB")){
p="XY";
}
char c=p[0];
if(!press(p.substr(0, 1))){
c=p[1];
}
S+=c;
for(char i: a){
if(i!=c){
let.push_back(i);
// cerr<<a[i]<<" ";
}
}
//cerr<<endl;
int coins=0;
for(int i=2; i<n; i++){
curr=S+let[0]+let[0] + S+let[0]+let[1] + S+let[0]+let[2] + S+let[1];
coins=press(curr);
if(coins==i+1){
S+=let[0];
}
if(coins==i){
S+=let[1];
}
if(coins==i-1){
S+=let[2];
}
}
if(press(S+let[0])==n){
S+=let[0];
}else{
if(press(S+let[1])==n){
S+=let[1];
}else{
S+=let[2];
}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |