제출 #236991

#제출 시각아이디문제언어결과실행 시간메모리
236991kai824콤보 (IOI18_combo)C++17
100 / 100
41 ms620 KiB
#include"combo.h" #include"bits/stdc++.h" using namespace std; string guess_sequence(int n){ string cur,choices="",abxy="ABXY",t; if(press("AB")>0){ if(press("A")>0)cur="A"; else cur="B"; }else{ if(press("X")>0)cur="X"; else cur="Y"; } if(n==1)return cur; for(int i=0;i<4;i++){ if(cur[0]==abxy[i])continue; choices+=abxy[i]; } int k; for(int i=1;i<n-1;i++){ t=""; for(int j=0;j<3;j++)t+=cur+choices[0]+choices[j]; k=press(t+cur+choices[1]); if(k==i)cur+=choices[2]; else if(k==i+1)cur+=choices[1]; else{ cur+=choices[0]; } } if(press(cur+choices[0])==n){ return cur+choices[0]; }else{ if(press(cur+choices[1])==n)return cur+choices[1]; else return cur+choices[2]; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...