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 C = "ABXY";
string guess_sequence(int n){
string s = "AB";
if(press(s)){
s = "A";
if(!press(s)) s = "B";
}
else{
s = "X";
if(!press(s)) s = "Y";
}
string S[3];
for(int i=0; i<3; i++) S[i] = s;
string CC;
for(int i=0; C[i]; i++) if(C[i]!=s[0]){
CC.push_back(C[i]);
}
for(int i=1; i<n; i++){
int score = S[0].length();
S[0].push_back(CC[0]);
S[0].push_back(CC[0]);
S[1].push_back(CC[1]);
int nxt = press(S[0]+S[1]);
char ch;
if(nxt==score) ch = CC[2];
else if(nxt==score+1) ch = CC[1];
else ch = CC[0];
S[0].pop_back();
for(int j=0; j<3; j++) S[j].back() = ch;
}
return S[0];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |