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 answer = "";
if(press("AB")){
if(press("A")){
answer += "A";
}
else{
answer += "B";
}
}
else{
if(press("X")){
answer += "X";
}
else{
answer += "Y";
}
}
if(N == 1){
return answer;
}
vector<char> cand;
if(answer[0] != 'A')cand.push_back('A');
if(answer[0] != 'B')cand.push_back('B');
if(answer[0] != 'X')cand.push_back('X');
if(answer[0] != 'Y')cand.push_back('Y');
string g;
for(int i = 1; i <= N - 2; ++i){
g = answer + cand[0] + cand[0] + answer + cand[0] + cand[1] + answer + cand[0] + cand[2] + answer + cand[1];
int val = press(g);
if(val == (int)answer.size() + 2){
answer += cand[0];
}
else if(val == (int)answer.size() + 1){
answer += cand[1];
}
else{
answer += cand[2];
}
}
g = answer + cand[0] + answer + cand[1];
if(press(g) == N){
g = answer + cand[0];
if(press(g) == N){
answer += cand[0];
}
else{
answer += cand[1];
}
}
else{
answer += cand[2];
}
return answer;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |