Submission #434745

#TimeUsernameProblemLanguageResultExecution timeMemory
434745OttoTheDinoCombo (IOI18_combo)C++17
100 / 100
42 ms660 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { int x=press("AB"),y=press("AX"),val; string a="ABXY"; if (x>0&&y==0)a="BAXY"; else if (x==0&&y>0)a="XABY"; else if (x==0&&y==0)a="YABX"; string ans(1,a[0]),s; if (n==1)return ans; for(int i=0;i<n-2;++i) { s=ans+a[2]; for(int j=1;j<4;++j)s+=ans+a[1]+a[j]; val=press(s); if (val==i+1) ans+=a[3]; else if (val==i+2) ans+=a[2]; else ans+=a[1]; } if (press(ans+a[1]+ans+a[2])==n) { if (press(ans+a[1])==n) return ans+a[1]; return ans+a[2]; } return ans+a[3]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...