# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1142237 | joker | 콤보 (IOI18_combo) | C++17 | 0 ms | 0 KiB |
#include<combo.h>
#include <unordered_set>
#include <unordered_map>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <numeric>
using namespace std;
std::string guess_sequence(int N) {
string S = "";
vector<char> btns = {'X','Y','B'};
int frstidx = -1;
while (S.length() != N) {
if (S.length() == 0) {
for (size_t i = 0; i < 3; i++) {
string st;
st += btns[i];
int coin = press(st);
if (coin == 1) {
frstidx = i;
S += btns[i];
break;
} else if (i == 2) {
S += 'A';
}
}
} else {
bool ps = false;
for (size_t i = 0; i < 3; i++) {
if (i != frstidx) {
string st = S+btns[i];
int coin = press(st);
if (coin == S.length()+1) {
ps = true;
S += btns[i];
break;
}
}
}
if (!ps) {
S += 'A';
}
}
}
return S;
}