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 k = "ABXY", s;
vector<string> v;
string guess_sequence(int n){
string p = "", P = "";
if(press(P + k[0] + k[1]) >= 1){
if(press(P + k[0]) == 1) p.push_back(k[0]);
else p.push_back(k[1]);
}else{
if(press(P + k[2]) == 1) p.push_back(k[2]);
else p.push_back(k[3]);
}
for(int i=0;i<4;i++) if(k[i] != p[0]) s.push_back(k[i]);
if(n == 1) return p;
string S = "";
v.push_back(S + s[0]);
S.push_back(s[1]);
for(int i=0;i<3;i++) v.push_back(S + s[i]);
for(int i=1;i<=n-2;i++){
int k = press(p + v[0] + p + v[1] + p + v[2] + p + v[3]);
if(k == i){
p.push_back(s[2]);
}else if(k == i + 1){
p.push_back(s[0]);
}else if(k == i + 2){
p.push_back(s[1]);
}
}
if(press(p + s[0] + p + s[1]) == n){
if(press(p + s[0]) == n) p.push_back(s[0]);
else p.push_back(s[1]);
}else{
p.push_back(s[2]);
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |