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;
vector<char>t{'A', 'B', 'X', 'Y'};
string guess_sequence(int N)
{
string ans, p;
p = "AB";
if(press(p)>=1)
{
p = "A";
if(press(p)==1) ans = "A";
else ans = "B";
}
else
{
p = "X";
if(press(p)==1) ans = "X";
else ans = "Y";
}
if(N==1) return ans;
for(int i = 0; i < 4; i++) {
if(t[i]==ans[0]) {
t.erase(t.begin()+i);
break;
}
}
for(int i = 2; i < N; i++)
{
p = ans+t[0];
for(auto c : t) {
p+=ans+t[1]+c;
}
int coins = press(p);
int n = ans.size();
if(coins==n) ans+=t[2];
else if(coins==n+1) ans+=t[0];
else ans+=t[1];
}
if(press(ans+t[0])==N) ans+=t[0];
else if(press(ans+t[1])==N) ans+=t[1];
else ans+=t[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |