제출 #718881

#제출 시각아이디문제언어결과실행 시간메모리
718881nguyentunglam콤보 (IOI18_combo)C++17
100 / 100
35 ms572 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { char head; if (press("AB")) { if (press("A")) head = 'A'; else head = 'B'; } else { if (press("X")) head = 'X'; else head = 'Y'; } string pref; pref.push_back(head); if (n == 1) return pref; vector<char> C; if (head != 'A') C.push_back('A'); if (head != 'B') C.push_back('B'); if (head != 'X') C.push_back('X'); if (head != 'Y') C.push_back('Y'); for(int i = 2; i < n; i++) { int tmp = press(pref + C[0] + pref + C[1] + C[0] + pref + C[1] + C[1] + pref + C[1] + C[2]); if (tmp == i - 1) pref += C[2]; else if (tmp == i) pref += C[0]; else pref += C[1]; } if (press(pref + C[0]) == n) pref.push_back(C[0]); else if (press(pref + C[1]) == n) pref.push_back(C[1]); else pref.push_back(C[2]); return pref; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...