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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int n) {
string v = "ABXY";
string ans = "";
int x = press("AB");
int f;
if(x > 0){
x = press("A");
if(x > 0)f = 0;
else f = 1;
}else{
x = press("X");
if(x > 0)f = 2;
else f = 3;
}
ans+=v[f];
if(n == 1)return ans;
swap(v[3], v[f]);
for(int i = 1; i < n-1; i++){
string p = "";
for(int j = 0; j < 3; j++)p += ans+v[0]+v[j];
p += ans+v[1];
int x = press(p);
if(x==(int)ans.size())ans+=v[2];
else if(x-1 == (int)ans.size())ans+=v[1];
else ans+=v[0];
}
if(press(ans+v[0]) == n)return ans+v[0];
else if(press(ans+v[1]) == n)return ans+v[1];
return ans+v[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |