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;
// int press(string mn){
// int tc;
// cout << mn << endl;
// cin >> tc;
// return tc;
// }
int n;
vector<string> v = {"A","B","X","Y"};
string guess_sequence(int N){
n = N;
// cin >> n;
string s = "";
if(press("AB")){
if(press("A")){
s = "A";
v.erase(v.begin());
}
else{
s = "B";
v.erase(v.begin()+1);
}
}
else{
if(press("X")){
s = "X";
v.erase(v.begin()+2);
}
else{
s = "Y";
v.erase(v.begin()+3);
}
}
for(int i = 1; i <= n-2; ++i){
int csi = i;
string pos = "";
pos += (s+v[0]);
pos += (s+v[1]+v[0]);
pos += (s+v[1]+v[1]);
pos += (s+v[1]+v[2]);
int val = press(pos);
if(val == csi){
s += v[2];
}
if(val == csi+1){
s += v[0];
}
if(val == csi+2){
s += v[1];
}
}
if(press(s+v[0]+s+v[1]) == n){
if(press(s+v[0]) == n){
s += v[0];
}
else{
s += v[1];
}
}
else{
s += v[2];
}
return s;
}
// int main(){
// cout << guess_sequence(0) << endl;
// return 0;
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |