Submission #764209

#TimeUsernameProblemLanguageResultExecution timeMemory
764209DJeniUpCombo (IOI18_combo)C++17
100 / 100
28 ms456 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; string res,b,c,d; string guess_sequence(int n) { ll r=press("AB"); ll x=1; if(r==2){ res="AB"; n-=2; b="B"; c="X"; d="Y"; x=2; }else if(r==1){ if(press("A")==1){ res="A"; n--; b="B"; c="X"; d="Y"; }else{ res="B"; n--; b="A"; c="X"; d="Y"; } }else{ if(press("X")==1){ res="X"; n--; b="B"; c="A"; d="Y"; }else{ res="Y"; n--; b="A"; c="X"; d="B"; } } while(n>0){ if(n==1){ r=press(res+b+res+c); if(r-x==1){ if(press(res+b)-x==1){ res+=b; n--; }else{ res+=c; n--; } }else{ res+=d; n--; } }else{ r=press(res+b+c+res+b+d+res+c+b); if(r-x==0){ res+=d; n--; x++; }else if(r-x==1){ r=press(res+c+c); if(r-x==2){ res+=c+c; n-=2; x+=2; }else if(r-x==1){ res+=c+d; n-=2; x+=2; }else{ res+=b+b; n-=2; x+=2; } }else if(r-x==2){ r=press(res+b+c); if(r-x==2){ res+=b+c; n-=2; x+=2; }else if(r-x==1){ res+=b+d; n-=2; x+=2; }else{ res+=c+b; n-=2; x+=2; } } } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...