Submission #846141

#TimeUsernameProblemLanguageResultExecution timeMemory
846141czaudernaCombo (IOI18_combo)C++17
100 / 100
13 ms2208 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string c[3]; void stp(string s){ int x=0; string ben[4]={"A", "B", "X", "Y"}; for(int i=0; i<4; i++){ if(ben[i]==s)continue; c[x]=ben[i]; x++; } } string guess_sequence(int N){ string p="AB"; int x=press(p), lst=1; if(x==0){ p="X"; if(press(p)==0) p="Y"; }else if(x==1){ p="A"; if(press(p)==0) p="B"; }else p="A"; stp(p); string S=""; for(int i=2; i<N; i++){ S=p+c[0]+p+c[1]+c[0]+p+c[1]+c[1]+p+c[1]+c[2]; x=press(S); if(x-lst==0) p=p+c[2]; else if(x-lst==1) p=p+c[0]; else p=p+c[1]; lst++; } if(lst==N) return p; if(press(p+c[0])>lst){ p=p+c[0]; return p; } if(press(p+c[1])>lst) p=p+c[1]; else p=p+c[2]; return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...