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 "combo.h"
#include <bits/stdc++.h>
#define dbg(x) cerr << #x << ": " << x << endl;
#define raya cerr << "======================" << endl;
using namespace std;
string guess_sequence(int N) {
string s = "";
string aux = "ABXY";
for(int j=0; j<4; ++j){
s += aux[j];
if(j == 3){
break;
}
if(press(s)){
break;
}
s.pop_back();
}
string tmp = aux;
aux = "";
for(char c : tmp){
if(c != s[0]){
aux += c;
}
}
string a; a += aux[0];
string b; b += aux[1];
string c; c += aux[2];
for(int i=1; i<N; ++i){
if(i == N-1){
int p = press(s+a);
if(p == i+1){
s += a;
break;
}
p = press(s+b);
if(p == i+1){
s += b;
break;
}
s += c;
break;
}
int p = press(s+a+s+b+a+s+b+b+s+b+c);
if(p == i+1){
s += a;
} else if(p == i+2){
s += b;
} else {
s += c;
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |