| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1317888 | jokuk | 콤보 (IOI18_combo) | C++20 | 0 ms | 0 KiB |
#include<combo.h>
#include<bits/stdc++.h>
using namespace std;
vector<string> choices = {"A","B","X","Y"};
string guess_sequence(int n){
cin.tie(nullptr)->sync_with_stdio(false);
string p="";
if(press("AB"))
{
if(press("A"))
{
p+="A";
}
else
{
p+="B";
}
}
else
{
if(press=="X")
{
p+="X";
}
else
{
p+="Y";
}
}
int cur = 1;
for(int i = 0; i < 4; i++)
{
if(p[0] == choices[i][0])
{
choices.erase(choices.begin()+i);
}
}
for(int i=2;i<n;i++)
{
string temp = p+choices[0];
temp += p+choices[1]+choices[0];
temp += p+choices[1]+choices[1];
temp += p+choices[1]+choices[2];
int res = press(temp);
if(res == cur)
{
p+=choices[2];
}
else if(res == cur+1)
{
p+=choices[0];
}
else if(res == cur+2)
{
p+=choices[1];
}
cur++;
}
if(p.length()==n) return p;
if(press(p+choices[0])==n) p+=choices[0];
else if(press(p+choices[1])==n) p+= choices[1];
else p+= choices[2];
return p;
}
