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;
#define pb push_back
char all_possible[4]={'A','B','X','Y'};
vector<char> guess_all;
string guess_sequence(int N){
int mark=3;
string answer;
string guess;
for(int i=0;i<3;i++){
guess.pb(all_possible[i]);
if(press(guess)){
answer.pb(all_possible[i]);
mark = i;
}
guess.pop_back();
}
if(mark==3) answer.pb('Y');
for(int i=0;i<4;i++){
if(i!=mark) guess_all.pb(all_possible[i]);
}
if(N==1) return answer;
for(int i=0;i<N-2;i++){
guess.clear();
for(auto i : answer) guess.pb(i);
guess.pb(guess_all[0]);
guess.pb(guess_all[0]);
//if(press(guess)==i+3) {answer.pb(guess_all[0]);continue;}
for(auto i : answer) guess.pb(i);
guess.pb(guess_all[0]);
guess.pb(guess_all[1]);
//if(press(guess)==i+3) {answer.pb(guess_all[0]);continue;}
for(auto i : answer) guess.pb(i);
guess.pb(guess_all[0]);
guess.pb(guess_all[2]);
//if(press(guess)==i+3) {answer.pb(guess_all[0]);continue;}
for(auto i : answer) guess.pb(i);
guess.pb(guess_all[1]);
int check = press(guess);
if(check==i+3) answer.pb(guess_all[0]);
else if(check==i+2) answer.pb(guess_all[1]);
else answer.pb(guess_all[2]);
}
for(int i=0;i<1;i++){
guess.clear();
for(auto i : answer) guess.pb(i);
guess.pb(guess_all[0]);
if(press(guess)==N) {answer.pb(guess_all[0]);continue;}
guess.clear();
for(auto i : answer) guess.pb(i);
guess.pb(guess_all[1]);
if(press(guess)==N) {answer.pb(guess_all[1]);continue;}
answer.pb(guess_all[2]);
}
return answer;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |