제출 #642811

#제출 시각아이디문제언어결과실행 시간메모리
642811Alexandruabcde콤보 (IOI18_combo)C++14
100 / 100
37 ms568 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char First; string letters; char FindFirst () { if (press("AB") != 0) { if (press("A")) return 'A'; return 'B'; } if (press("X")) return 'X'; return 'Y'; } string ans; char FindCaracter (int sz) { string query = ans + letters[0] + ans + letters[1] + letters[0] + ans + letters[1] + letters[1] + ans + letters[1] + letters[2]; int lg = press(query); if (lg == sz + 1) return letters[1]; if (lg == sz) return letters[0]; return letters[2]; } char FindLast (int N) { string query = ans + letters[0]; int lg = press(query); if (lg == N) return letters[0]; query = ans + letters[1]; lg = press(query); if (lg == N) return letters[1]; return letters[2]; } std::string guess_sequence(int N) { First = FindFirst(); ans = ""; if (First == 'A') letters = "BXY"; if (First == 'B') letters = "AXY"; if (First == 'X') letters = "ABY"; if (First == 'Y') letters = "ABX"; ans = First; if (N == 1) return ans; for (int i = 2; i < N; ++ i ) ans += FindCaracter(i); ans += FindLast(N); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...