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 ans;
vector<char> v;
if(N == 1){
if(press("A"))return "A";
if(press("B"))return "B";
if(press("X"))return "X";
return "Y";
}
if(press("AB")){
if(press("A")){
ans = "A";
v = {'B', 'X', 'Y'};
}
else{
ans = "B";
v = {'A', 'X', 'Y'};
}
}
else if(press("X")){
ans = "X";
v = {'A', 'B', 'Y'};
}
else {
ans = "Y";
v = {'A', 'B', 'X'};
}
for(int i = 2; i < N; ++i){
int coins = press(ans+v[0]+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2]);
if(coins == i-1)ans+=v[2];
else if(coins == i)ans+=v[0];
else ans+=v[1];
}
if(press(ans+v[0]) == N)ans+=v[0];
else if(press(ans+v[1]) == N)ans+=v[1];
else ans+=v[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |