제출 #762075

#제출 시각아이디문제언어결과실행 시간메모리
762075Andrey콤보 (IOI18_combo)C++14
100 / 100
26 ms552 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int n) { string ans = ""; string p = ""; if(press("AB") > 0) { if(press("A") > 0) { ans = "A"; } else { ans = "B"; } } else { if(press("X") > 0) { ans = "X"; } else { ans = "Y"; } } char buk[4] = {'A','B','X','Y'}; vector<char> bruh(0); for(int i = 0; i < 4; i++) { if(buk[i] != ans[0]) { bruh.push_back(buk[i]); } } for(int i = 1; i < n-1; i++) { p = ""; p+=ans; p+=bruh[0]; p+=ans; p+=bruh[1]; p+=bruh[0]; p+=ans; p+=bruh[1]; p+=bruh[1]; p+=ans; p+=bruh[1]; p+=bruh[2]; int c = press(p); if(c == i) { ans+=bruh[2]; } else if(c == i+1) { ans+=bruh[0]; } else { ans+=bruh[1]; } } if(n > 1) { if(press(ans+bruh[0]) == n) { ans+=bruh[0]; } else if(press(ans+bruh[1]) == n) { ans+=bruh[1]; } else { ans+=bruh[2]; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...