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 s);
string guess_sequence(int N){
string arr[4]={"A","B","X","Y"};
vector<string>v;
if(N==1){
for(int i=0;i<3;i++){
if(press(arr[i]) == 1) return arr[i];
}
return arr[3];
}
else{
string ans = "";
string start = "";
if(press("AB") > 0){
if(press("A") == 1) start = "A";
else start = "B";
}
else{
if(press("C") == 1) start = "X";
else start = "Y";
}
ans = start;
for(int i=0;i<4;i++) if(arr[i]!=start) v.push_back(arr[i]);
assert(v.size() == 3);
for(int i=0;i<N-2;i++){
int r = ans.length();
string tr = "";
tr += ans + v[0];
tr += ans + v[1] + v[0];
tr += ans + v[1] + v[1];
tr += ans + v[1] + v[2];
int x = press(tr);
if(x == r) ans+=v[2];
else if(x == r+1) ans += v[0];
else ans += v[1];
}
if(press(ans+v[0]) == N) return ans+v[0];
if(press(ans+v[1]) == N) return ans+v[1];
return ans+v[2];
}
assert(1==0);
return "";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |