제출 #963931

#제출 시각아이디문제언어결과실행 시간메모리
963931Mardonbekhazratov콤보 (IOI18_combo)C++17
100 / 100
17 ms2280 KiB
#include "combo.h" #include<vector> using namespace std; string guess_sequence(int n) { string p = ""; if(press("AB")){ if(press("A")) p+="A"; else p+="B"; } else{ if(press("X")) p+="X"; else p+="Y"; } if(n==1) return p; vector<char>d={'A','B','X','Y'}; for(int i=0;i<4;i++){ if(d[i]==p[0]){ d.erase(d.begin()+i); } } for(int i=2;i<n;i++){ string f1=p+d[0]+d[0]; string f2=p+d[0]+d[1]; string f3=p+d[0]+d[2]; string f4=p+d[1]; int x=press(f1+f2+f3+f4); if(x==i-1){ p+=d[2]; } else if(x==i){ p+=d[1]; } else{ p+=d[0]; } } for(int i=0;i<2;i++){ string f=p+d[i]; if(press(f)==n){ p+=d[i]; break; } if(i==1) p+=d[2]; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...