# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
138250 | Lawliet | 콤보 (IOI18_combo) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
char buttons[] = {'A' , 'B' , 'X' , 'Y'};
int N;
string S;
string remain;
int getInd(char a)
{
for(int g = 0 ; g < 4 ; g++)
if(buttons[g] == a) return g;
}
int press(string p)
{
printf("-> %s\n",p.c_str());
int a;
scanf("%d",&a);
return a;
}
void getFirstButton()
{
if( press("AB") >= 1 )
{
if( press("A") == 1 ) S[0] = 'A';
else S[0] = 'B';
}
else
{
if( press("C") == 1 ) S[0] = 'C';
else S[0] = 'D';
}
}
string guess_sequence(int n)
{
N = n;
getFirstButton();
for(int h = 0 ; h < 4 ; h++)
if(buttons[h] != S[0])
remain = remain + buttons[h];
for(int g = 1 ; g < N ; g++)
{
int cnt = 0;
for(int h = 0 ; h < 2 ; h++)
{
//printf("S = %s\n",S.c_str());
//S.push_back(remain[h]);
if(press(S + remain[h]) == S.size() + 1)
{
S = S + remain[h];
break;
}
//S.pop_back();
}
if(S.size() == g)
S = S + remain[2];
}
return S;
}
/*int main()
{
int nn;
scanf("%d",&nn);
cout << guess_sequence( nn ) << endl;
}*/