제출 #855158

#제출 시각아이디문제언어결과실행 시간메모리
855158Huseyn123콤보 (IOI18_combo)C++17
100 / 100
10 ms1868 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string s="",p=""; vector<char> c; c.push_back('A'); c.push_back('B'); c.push_back('X'); c.push_back('Y'); if(press("AB")){ if(press("A")){ c.erase(c.begin()); s+='A'; } else{ c.erase(c.begin()+1); s+='B'; } } else{ if(press("X")){ c.erase(c.begin()+2); s+='X'; } else{ c.erase(c.begin()+3); s+='Y'; } } for(int i=1;i<=N-2;i++){ p=""; p+=s; p+=c[0]; p+=s; p+=c[1]; p+=c[0]; p+=s; p+=c[1]; p+=c[1]; p+=s; p+=c[1]; p+=c[2]; int h=press(p); if(h==i){ s+=c[2]; } else if(h==i+1){ s+=c[0]; } else{ s+=c[1]; } } if(N>1){ p=s; p+=c[0]; p+=s; p+=c[1]; if(press(p)==N){ p=s; p+=c[0]; if(press(p)==N){ s+=c[0]; } else{ s+=c[1]; } } else{ s+=c[2]; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...