Submission #438878

#TimeUsernameProblemLanguageResultExecution timeMemory
438878BT21tataCombo (IOI18_combo)C++17
100 / 100
43 ms616 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; char c[4]={'A', 'B', 'X', 'Y'}; int f, cnt=1; inline int r(int x) { return (f+x)%4; } string guess_sequence(int n) { string s; if(press("AB")) { if(press("A")) f=0, s+='A'; else f=1, s+='B'; } else { if(press("X")) f=2, s+='X'; else f=3, s+='Y'; } while(cnt<n-1) { int x=press(s+c[r(1)] + s+c[r(2)]+c[r(1)] + s+c[r(2)]+c[r(2)] + s+c[r(2)]+c[r(3)]); if(x==cnt) s+=c[r(3)]; else if(x==cnt+1) s+=c[r(1)]; else s+=c[r(2)]; cnt++; } if(n!=1) { if(press(s+c[r(2)])==n) s+=c[r(2)]; else if(press(s+c[r(1)])==n) s+=c[r(1)]; else s+=c[r(3)]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...