# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
492999 | DDDNNN | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define forinc(i,a,b) for(int i=a;i<=b;i++)
#define fordec(i,a,b) for(int i=a;i>=b;i--)
#define fiora(i,a) for(auto i:a)
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define getbit(x,i) ((x>>(i))&1ll)
#define batbit(x,i) (x|(1ll<<(i)))
#define tatbit(x,i) (x&~(1<<(i)))
#define gg return 0;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r)
{
return l+rng()%(r-l+1);
}
string d[]={"A","B","X","Y"};
bool dd[5];
string s="";
main()
{
int fi=4;
int cnt=0;
int num=0;
while(1)
{
memset(dd,0,sizeof dd);
dd[fi]=1;
int oyr=cnt;
while(dd[0]==0||dd[1]==0||dd[2]==0||dd[3]==0)
{
int x=rnd(0,3);
if(x==fi) continue;
if(dd[x]==1) continue;
dd[x]=1;
cout<<s+d[x];
fflush(stdout);
int ret;
cin>>ret;
if(ret==cnt) continue;
if(num==0)
{
fi=x;
num=1;
}
s+=d[x];
cnt=ret;
break;
}
if(cnt==oyr)
{
cout<<s;
fflush(stdout);
return 0;
break;
}
//cout<<fi<<"\n";;
}
}