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;
#define pb push_back
#define ar array
string guess_sequence(int n) {
srand(time(0));
string ans="";
vector<char> c, cc = {'A', 'B', 'X', 'Y'};
char first;
int ret = press(ans+cc[0]+cc[1]);
if(ret == 0){
ret = press(ans+cc[3]);
if(ret == 1){
first = cc[3];
}else first = cc[2];
}else{
ret = press(ans+cc[0]);
if(ret == 1){
first = cc[0];
}else first = cc[1];
}
ans += first;
for(char ch : cc){
if(ch != first) c.pb(ch);
}
for(int i = 1; i < n; ++i){
random_shuffle(c.begin(), c.end());
if(i == n-1){
int ret = press(ans+c[0]);
if(ret == i+1){
ans.pb(c[0]);
}else{
ret = press(ans+c[1]);
if(ret == i+1){
ans.pb(c[1]);
}else ans.pb(c[2]);
}
break;
}
ar<string,4> ask;
ask[0] = {c[0], c[0]};
ask[1] = {c[0], c[1]};
ask[2] = {c[0], c[2]};
ask[3] = {c[1]};
int ret = press(ans+ask[0]+ans+ask[1]
+ans+ask[2]+ans+ask[3]);
if(ret == i){
ans += c[2];
}else if(ret == i+1){
ans += c[1];
}else{
ans += c[0];
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |