제출 #770717

#제출 시각아이디문제언어결과실행 시간메모리
770717AtinaR콤보 (IOI18_combo)C++14
30 / 100
36 ms648 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { char first; int f=press("AB"); if(f>=1) { f=press("A"); if(f>=1) { first='A'; } else { first='B'; } } else { f=press("X"); if(f>=1) { first='X'; } else first='Y'; } string res=""; res+=first; char possible[3]; if(first=='X') { possible[0]='A'; possible[1]='B'; possible[2]='Y'; } else if(first=='Y') { possible[0]='A'; possible[1]='B'; possible[2]='X'; } else if(first=='A') { possible[0]='X'; possible[1]='B'; possible[2]='Y'; } else if(first=='B') { possible[0]='A'; possible[1]='X'; possible[2]='Y'; } while((int)res.size()<N) { int tmp; string A=res+possible[0]; string B=res+possible[1]; string C=res+possible[2]; tmp=press(A); if(tmp==(int)A.size()) { res=A; continue; } tmp=press(B); if(tmp==(int)B.size()) { res=B; continue; } res=C; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...