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;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i)
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
string guess_sequence(int n){
int x = 0;
x = press("A");
string ans = "";
if(x){
string s = "BXY";
do{
ans = "A";
for(int i = 0; i <= 1; ++i)
ans += s[i];
if(press(ans) == n)
return ans;
}while(next_permutation(all(s)));
for(char &to : s){
ans = "A";
for(int i = 0; i <= 1; ++i)
ans += to;
if(press(ans) == n)
return ans;
}
}
x = press("B");
if(x){
string s = "AXY";
do{
ans = "B";
for(int i = 0; i <= 1; ++i)
ans += s[i];
if(press(ans) == n)
return ans;
}while(next_permutation(all(s)));
for(char &to : s){
ans = "B";
for(int i = 0; i <= 1; ++i)
ans += to;
if(press(ans) == n)
return ans;
}
}
x = press("X");
if(x){
string s = "ABY";
do{
ans = "X";
for(int i = 0; i <= 1; ++i)
ans += s[i];
if(press(ans) == n)
return ans;
}while(next_permutation(all(s)));
for(char &to : s){
ans = "X";
for(int i = 0; i <= 1; ++i)
ans += to;
if(press(ans) == n)
return ans;
}
}
// s[0] = 'Y'
string s = "ABX";
do{
ans = "Y";
for(int i = 0; i <= 1; ++i)
ans += s[i];
if(press(ans) == n)
return ans;
}while(next_permutation(all(s)));
for(char &to : s){
ans = "Y";
for(int i = 0; i <= 1; ++i)
ans += to;
if(press(ans) == n)
return ans;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |