이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
/^--^\
\____/
/ \ _____ _ __ __ ____ _ ____ ____ _____
| || ()_)| |\ \/ /| ===|| |__ / (__` / () \|_ _|
\__ __/ |_| |_|/_/\_\|____||____|\____)/__/\__\ |_|
|^|^\ \^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|
| | |\ \| | | | | | | | | | | | | | | | | | | | | | | | |
#####/ /#################################################
| | |\/ | | | | | | | | | | | | | | | | | | | | | | | | |
|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|*/
//#pragma GCC optimize("O4,unroint-loops,no-stack-protector")
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<ll,ll>;
//using pii=pair<int,int>;
#define int ll //__int128
#define double long double
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second
#define L(id) (id*2+1)
#define R(id) (id*2+2)
#define LO(x) (x&(-x))
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define mkp make_pair
#define MOD (int)(1e9+7)
#define INF (int)(1e15)
#define EPS (1e-9)
#ifdef LOCALMEOW
#define debug(...) do{\
cerr << __LINE__ <<\
" : ("#__VA_ARGS__ << ") = ";\
_OUT(__VA_ARGS__);\
}while(0)
template<typename T> void _OUT(T x) { cerr << x << "\n"; }
template<typename T,typename...I>
void _OUT(T x,I ...tail) { cerr << x << ", "; _OUT(tail...); }
#else
#define debug(...)
#endif
inline void NYA(){ ios::sync_with_stdio(false); cin.tie(0); }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//mt19937 rng((ull)new char);
int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p,const int &mod){
int ans=1,now=b;
while(p){
if(p&1) ans=ans*now%mod;
p/=2; now=now*now%mod;
}
return ans;
}
int fpow(int b,int p) { return fpow(b,p,MOD); }
void chmin(int &a,const int &b) { if(b<a) a=b; }
void chmax(int &a,const int &b) { if(b>a) a=b; }
#include "combo.h"
string guess_sequence(int32_t N){
if(N==1){
if(press("A")==1) return "A";
if(press("B")==1) return "B";
if(press("X")==1) return "X";
return "Y";
}
string ans="";
int k=press("AB");
if(k){
//A or B
k=press("A");
if(k) ans="A";
else ans="B";
}else{
//X or Y
k=press("X");
if(k) ans="X";
else ans="Y";
}
string s="ABXY";
For(i,0,3){
if(s[i]==ans[0]){
s.erase(i,1);
break;
}
}
For(i,1,N-2){
k=press(ans+s[0]+ans+s[1]+s[0]+ans+s[1]+s[1]+ans+s[1]+s[2]);
if(k==i) ans+=s[2];
else if(k==i+1) ans+=s[0];
else ans+=s[1];
}
if(press(ans+s[0])==N) ans+=s[0];
else if(press(ans+s[1])==N) ans+=s[1];
else ans+=s[2];
//assert(press(ans)==N);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |