제출 #379860

#제출 시각아이디문제언어결과실행 시간메모리
379860SuhaibSawalha1콤보 (IOI18_combo)C++14
100 / 100
49 ms548 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; if (press("AB")) { if (press("A")) { ans = "A"; } else { ans = "B"; } } else { if (press("X")) { ans = "X"; } else { ans = "Y"; } } ca.erase(find(ca.begin(), ca.end(), ans[0])); 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...