이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "combo.h"
#define inf 1000000007
#define mod 1000000007
#define rnd() rand_num()
#define bigrnd() dis(rand_num)
//#pragma GCC optimize("Ofast","inline","-ffast-math")
//#pragma GCC target("avx,sse2,sse3,sse4,mmx")
//#define int long long
using namespace std;
unsigned sed=std::chrono::system_clock::now().time_since_epoch().count();
mt19937 rand_num(sed);
uniform_int_distribution<long long> dis(0,inf);
template <typename T> void read(T &x){
x=0;char ch=getchar();int fh=1;
while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
x*=fh;
}
template <typename T> void write(T x) {
if (x<0) x=-x,putchar('-');
if (x>9) write(x/10);
putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
write(x);
puts("");
}
int res[2005];
string get(int val)
{
return (val==1?"A":(val==2?"B":(val==3?"X":"Y")));
}
string guess_sequence(int n)
{
int rpl;
rpl=press("AB");
if(rpl>=1)
{
rpl=press("A");
if(rpl>=1) res[1]=1;
else res[1]=2;
}
else
{
rpl=press("X");
if(rpl>=1) res[1]=3;
else res[1]=4;
}
string cur;
cur+=get(res[1]);
int b=(res[1]==1?2:1);
int c=(res[1]==b+1?b+2:b+1);
int d=(res[1]==c+1?c+2:c+1);
if(n==1) return cur;
for(int i=2;i<=n-1;++i)
{
string ask;
ask+=cur;
ask+=get(b);
ask+=get(b);
ask+=cur;
ask+=get(b);
ask+=get(c);
ask+=cur;
ask+=get(b);
ask+=get(d);
ask+=cur;
ask+=get(c);
rpl=press(ask);
if(rpl==i+1)
res[i]=b;
else if(rpl==i)
res[i]=c;
else
res[i]=d;
cur+=get(res[i]);
}
string ask;
ask+=cur;
ask+=get(b);
rpl=press(ask);
if(rpl==n) return ask;
ask="";
ask+=cur;
ask+=get(c);
rpl=press(ask);
if(rpl==n) return ask;
ask="";
ask+=cur;
ask+=get(d);
return ask;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |