Submission #108127

#TimeUsernameProblemLanguageResultExecution timeMemory
108127autumn_eelCombo (IOI18_combo)C++14
100 / 100
51 ms584 KiB
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; #include "combo.h" string s="ABXY"; string guess_sequence(int N) { function<char(string)>dfs=[&](string s){ if(s.size()==1)return s[0]; int res=press(s.substr(0,s.size()/2)); if(res)return dfs(s.substr(0,s.size()/2)); return dfs(s.substr(s.size()/2)); }; char c=dfs(s); string ans;ans+=c; if(N==1)return ans; string t; rep(i,4){ if(s[i]!=c)t+=s[i]; } for(int i=1;i<N-1;i++){ string ask=ans+t[0]; rep(j,3)ask+=ans+t[1]+t[j]; int res=press(ask); if(res==i){ ans+=t[2]; } else if(res==i+1){ ans+=t[0]; } else if(res==i+2){ ans+=t[1]; } else abort(); } char last='?'; rep(i,2){ int res=press(ans+t[i]); if(res==N){ last=t[i]; break; } } if(last=='?')last=t[2]; ans+=last; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...