# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
600629 | piOOE | 콤보 (IOI18_combo) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess(int n) {
string s;
if (press("AB")) {
if (press("A")) {
s = "A";
} else {
s = "B";
}
} else {
if (press("X")) {
s = "X";
} else {
s = "Y";
}
}
if (n == 1) {
return s;
}
string L;
if (s == "A") {
L = "BXY";
} else if (s == "B") {
L = "AXY";
} else if (s == "X") {
L = "ABY";
} else {
L = "ABX";
}
for (int i = 1; i < n - 1; ++i) {
string str[3] = {s + L[0], s + L[1], s + L[2]};
int val = press(str[0] + L[0] + str[0] + L[1] + str[0] + L[2] + str[1]);
if (val == i + 2) {
s += L[0];
} else if (val == i + 1) {
s += L[1];
} else {
s += L[2];
}
}
if (press(s + L[0]) == n) {
return s + L[0];
} else if (press(s + L[1]) == n) {
return s + L[1];
} else {
return s + L[2];
}
}