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 <iostream>
using namespace std;
int press(string p);
string guess_sequence(int N){
int maxi = 0;
string arr[4];
arr[0] = "A";
arr[1] = "B";
arr[2] = "X";
arr[3] = "Y";
string ans = "";
for(int i = 0;i<3;i++){
if(press(arr[i]) > maxi){
maxi = 1;
ans += arr[i];
break;
}
}
if(ans == ""){
ans = arr[3];
maxi = 1;
}
string neu[3];
int ptr = 0;
for(int i = 0;i<4;i++){
if(arr[i] != ans){
neu[ptr] = arr[i];
ptr++;
}
}
for(int i = 1;i<N;i++){
for(int j = 0;j<2;j++){
string temp = ans+neu[j];
if(press(temp) > maxi){
maxi++;
ans = temp;
break;
}
}
if(maxi != i-1){
ans += neu[2];
maxi++;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |