이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "combo.h"
#define maxn (int)(1e5+51)
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define endl '\n'
#define ll long long
#define pb push_back
#define ull unsigned long long
#define ii pair<int,int>
#define iii tuple<int,int,int>
#define inf 2000000001
#define mod 1000000007 //998244353
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }
char b[4]={'A','B','X','Y'};
string guess_sequence(int n){
string ans = "";
char first;
int q = press("AB");
if(q==1)first='B';
else if(q==2)first='A';
else{
q = press("XY");
if(q==1)first='Y';
else first='X';
}
ans+=first;
string um,dois,last,x1,x2,x3;
for(int i=0;i<4;++i){
if(b[i]==first)continue;
if(!sz(um))um += b[i];
else if(!sz(dois))dois += b[i];
else last += b[i];
}
x1+=um+um,x2+=um+dois,x3+=um+last;
for(int i=3;i<=n;++i){
string query = "";
query+=ans+dois;
query+=ans+x1;
query+=ans+x2;
query+=ans+x3;
q = press(query);
if(q==0)ans+=last;
else if(q==i)ans+=um;
else ans+=dois;
}
string query="";
query+=ans+um;
query+=ans+dois;
q = press(query);
if(q==n){
if(press(ans+um)==n)ans+=um;
else ans+=dois;
}else ans+=last;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |