제출 #683958

#제출 시각아이디문제언어결과실행 시간메모리
683958Juan콤보 (IOI18_combo)C++17
100 / 100
31 ms588 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string ans = ""; char A, B, C, D; set<int> st; st.insert('A'), st.insert('B'), st.insert('X'), st.insert('Y'); if(press("AB")){ if(press("A")) A = 'A'; else A = 'B'; } else{ if(press("X")) A = 'X'; else A = 'Y'; } ans+=A; if(N==1) return ans; st.erase(A); auto it = st.begin(); B = *it, it++, C = *it, it++, D = *it; for(int i = 1; i < N-1; i++){ string aux=""; aux+=ans, aux+=B; aux+=ans, aux+=C, aux+=B; aux+=ans, aux+=C, aux+=C; aux+=ans, aux+=C, aux+=D; int prs = press(aux) - i; if(prs==0) ans+=D; else if(prs==1) ans+=B; else if(prs==2) ans+=C; } string aux = ""; aux+=ans, aux+=B; if(press(aux)==N) ans+=B; else{ aux.pop_back(); aux+=C; if(press(aux)==N) ans+=C; else ans+=D; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...