제출 #742790

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