제출 #404340

#제출 시각아이디문제언어결과실행 시간메모리
404340hltk콤보 (IOI18_combo)C++17
100 / 100
55 ms568 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p; if (press("AB")) { p = press("A") ? "A" : "B"; } else { p = press("X") ? "X" : "Y"; } if (N == 1) return p; vector<char> opts{'A', 'B', 'X', 'Y'}; opts.erase(find(opts.begin(), opts.end(), p[0])); for (int i = 1; i < N - 1; ++i) { string k; k += p + opts[0] + opts[0]; k += p + opts[0] + opts[1]; k += p + opts[0] + opts[2]; k += p + opts[1]; int c = press(k); if (c == i + 2) { p += opts[0]; } else if (c == i + 1) { p += opts[1]; } else { p += opts[2]; } } for (int j = 0; j < 2; ++j) { if (press(p + opts[j]) == N) { return p + opts[j]; } } return p + opts[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...