제출 #850161

#제출 시각아이디문제언어결과실행 시간메모리
850161StefanSebez콤보 (IOI18_combo)C++14
100 / 100
14 ms1896 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string res = ""; string s="AB"; if(press(s)>0) { s="A"; if(press(s)>0) res+='A'; else res+='B'; } else { s="X"; if(press(s)>0)res+='X'; else res+='Y'; } vector<char>a; if(res[0]!='A')a.push_back('A'); if(res[0]!='B')a.push_back('B'); if(res[0]!='X')a.push_back('X'); if(res[0]!='Y')a.push_back('Y'); for(int i=1;i<=N-2;i++) { string temp=""; for(int j=0;j<=2;j++) { temp+=res; temp+=a[0]; temp+=a[j]; } temp+=res; temp+=a[1]; int x=press(temp); if(x==i) res+=a[2]; else if(x==i+1) res+=a[1]; else res+=a[0]; } if(N>1) { string temp=res; temp+=a[0]; if(press(temp)==N) { res+=a[0]; } else { temp=res; temp+=a[1]; if(press(temp)==N) { res+=a[1]; } else res+=a[2]; } } //cout<<res<<endl; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...