제출 #299480

#제출 시각아이디문제언어결과실행 시간메모리
299480dsjong콤보 (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char getFirst(){ if(press("AB")){ if(press("A")) return 'A'; return 'B'; } if(press("X")) return 'X'; return 'Y'; } std::string guess_sequence(int N) { char beg=getFirst(); string ans="", list="ABXY", choice=""; ans.push_back(beg); for(char c:list){ if(c==beg) continue; choice.push_back(c); } for(int i=1;i<N-1;i++){ string query=""; for(int i=0;i<3;i++){ query+=ans; query+=choice[0]; query+=choice[i]; } query+=ans; query+=choice[1]; int sz=ans.size(), ask=press(query); if(ask==sz+2) ans.push_back(choice[0]); else if(ask==sz+1) ans.push_back(choice[1]); else ans.push_back(choice[2]); } int sz=ans.size(); for(int i=0;i<2;i++){ if(press(ans+choice[i])==sz+1){ ans.push_back(choice[i]); return ans; } } ans.push_back(choice[2]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...