제출 #404337

#제출 시각아이디문제언어결과실행 시간메모리
404337hltk콤보 (IOI18_combo)C++17
97 / 100
54 ms664 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p; if (press("A")) p = "A"; else if (press("B")) p = "B"; else if (press("X")) p = "X"; else p = "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...