제출 #729446

#제출 시각아이디문제언어결과실행 시간메모리
729446t6twotwo콤보 (IOI18_combo)C++17
100 / 100
46 ms684 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string T[4] = {"A", "B", "X", "Y"}; string guess_sequence(int N) { if (N == 1) { if (press(T[0])) { return T[0]; } else if (press(T[1])) { return T[1]; } else if (press(T[2])) { return T[2]; } else { return T[3]; } } int p = -1; if (press(T[0] + T[1])) { if (press(T[0])) { p = 0; } else { p = 1; } } else if (press(T[2])) { p = 2; } else { p = 3; } string ans = T[p]; vector<string> S; for (int i = 0; i < 4; i++) { if (i != p) { S.push_back(T[i]); } } for (int i = 2; i < N; i++) { string s = ans + S[0] + ans + S[1] + S[0] + ans + S[1] + S[1] + ans + S[1] + S[2]; int v = press(s); if (v == i + 1) { ans = ans + S[1]; } else if (v == i) { ans = ans + S[0]; } else { ans = ans + S[2]; } } if (press(ans + S[0]) == N) { ans = ans + S[0]; } else if (press(ans + S[1]) == N) { ans = ans + S[1]; } else { ans = ans + S[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...