| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 319721 | Pety | Combo (IOI18_combo) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sentence (int n) {
string p;
char other1, other2, other3;
if (press("AB")) {
if (press("A")) {
p += 'A';
other1 = 'B'; other2 = 'X'; other3 = 'Y';
}
else {
p += 'B';
other1 = 'A'; other2 = 'X'; other3 = 'Y';
}
}
else {
if (press("X")) {
p += 'X';
other1 = 'B'; other2 = 'A'; other3 = 'Y';
}
else {
p += 'Y';
other1 = 'B'; other2 = 'X'; other3 = 'A';
}
}
for (int i = 1; i <= n - 2; i++) {
string query = p + other1 + p + other2 + other1 + p + other2 + other2 + p + other2 + other3;
int x = press(query);
if (x == i) p += other3;
if (x == i + 1) p += other1;
if (x == i + 2) p += other2;
}
if (press(p + other1) == n)
return p + other1;
if (press(p + other2) == n)
return p + other2;
return p + other3;
}
