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