# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
742226 | Rafi22 | Combo (IOI18_combo) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;
string guess_sequence(int n)
{
string ans="";
if(press("AB"))
{
if(press("A")) ans+='A';
else ans+='B';
}
else
{
if(press("X")) ans+='X';
else ans+='Y';
}
vector<char>V1={'A','B','X','Y'},V;
for(auto x:V1) if(x!=ans[0]) V.pb(x);
bool is=0;
for(int i=2;i<=n;i++)
{
if(is)
{
if(press(ans+V[0])==i) ans+=V[0];
else ans+=V[1];
is=0;
}
else
{
int k=press(ans+V[0]+V[2]+ans+V[1]+V[2]);
if(k<i) ans+=V[2];
else if(k==i)
{
if(press(ans+V[0])==i) ans+=V[0];
else ans+=V[1];
is=1;
}
else
{
if(press(ans+V[0])==i) ans+=V[0];
else ans+=V[1];
ans+=V[2];
i++;
}
}
}
return ans;
}