제출 #379857

#제출 시각아이디문제언어결과실행 시간메모리
379857SuhaibSawalha1콤보 (IOI18_combo)C++14
97 / 100
47 ms568 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; vector<char> ca {'A', 'B', 'X', 'Y'}, cand; string guess_sequence (int n) { string ans; for (int i = 0; i < 4; ++i) { ans = ca[i]; if (i == 3 || press(ans)) { ca.erase(ca.begin() + i); cand = ca; break; } } for (int i = 1; i < n - 1; ++i) { string ask = ans + ca[0] + ans + ca[1] + ca[0] + ans + ca[1] + ca[1] + ans + ca[1] + ca[2]; int x = press(ask); if (x == i) { ans += ca[2]; } else if (x == i + 1) { ans += ca[0]; } else { ans += ca[1]; } } return n == 1 ? ans : ans + (press(ans + ca[0]) == n ? ca[0] : press(ans + ca[1]) == n ? ca[1] : ca[2]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...