Submission #856602

#TimeUsernameProblemLanguageResultExecution timeMemory
8566028pete8Combo (IOI18_combo)C++14
100 / 100
13 ms1840 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include<bitset> #include "combo.h" using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define ppii pair<int,pii> #define pb push_back #define p push #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); using namespace std; /* int press(string a){ int ans=0; for(int i=0;i<a.size();i++){ int cnt=0; for(int j=0;j<p.size()&&i+j<a.size();j++){ if(a[i+j]==p[j])cnt++; else break; } ans=max(ans,cnt); } return ans; } */ string guess_sequence(int N){ string v[4]={"A","B","X","Y"}; string op="",ans="",tmp; if(press("AB")){ if(press("A"))ans="A"; else ans="B"; } else if(press("X"))ans="X"; else ans="Y"; if(N==1)return ans; for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i]; for(int i=1;i<N-1;i++){ string a=ans+op[0]+op[1]+ans+op[0]+op[2]+ans+op[0]+op[0]+ans+op[1]; int b=press(a); if(b==i+1)ans+=op[1]; else if(b==i+2)ans+=op[0]; else ans+=op[2]; } for(int i=0;i<3;i++){ string v=ans+op[i]; if(i==2)ans=v; else if(press(v)==N){ ans=v; break; } } return ans; } /* int main(){ cout<<guess_sequence(3); } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...