# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
963929 | 2024-04-16T03:52:51 Z | Mardonbekhazratov | Combo (IOI18_combo) | C++17 | 0 ms | 0 KB |
#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"; } 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; }