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>
using namespace std;
string guess_sequence(int N) {
vector<string> a = {"A", "B", "X", "Y"};
string ans = "";
if(!press(a[0] + a[1])){
if(!press(a[2])){
ans+=a[3];
}
else{
ans+=a[2];
a[2] = a[3];
}
}
else{
if(!press(a[0])){
ans+=a[1];
a[1] = a[3];
}
else{
ans+=a[0];
a[0] = a[3];
}
}
if(N==1) return ans;
for (int i = 1; i < N - 1; i++) {
int t = press(ans + a[0] + a[0] + ans + a[0] + a[1] + ans + a[0] + a[2] + ans + a[1]);
if(t == i + 2){
ans+=a[0];
}
else if(t == i + 1){
ans+=a[1];
}
else{
ans+=a[2];
}
}
if(press(ans+a[0])==N){
ans+=a[0];
}
else if(press(ans+a[1])==N){
ans+=a[1];
}
else{
ans+=a[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |