Submission #788195

#TimeUsernameProblemLanguageResultExecution timeMemory
788195BulaCombo (IOI18_combo)C++17
100 / 100
29 ms588 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() //#define int ll const ll mod=1e9+7; string guess_sequence(int n){ string s; vector<string> v={"A","B","X","Y"}; int x; if(press("AB")>0){ if(press("A")==1){ s=v[0]; x=0; }else{ s=v[1]; x=1; } }else{ if(press("X")==1){ s=v[2]; x=2; }else{ s=v[3]; x=3; } } vector<string> t; for(int i=0;i<4;i++){ if(i!=x) t.pb(v[i]); } if(n==1) return s; for(int i=1;i<n-1;i++){ string p=s+t[0]; for(int j=0;j<3;j++){ string k=s+t[1]; k+=t[j]; p+=k; } int N=(int) s.size(); int c=press(p); if(c==N){ s+=t[2]; }else if(c==N+1) s+=t[0]; else s+=t[1]; } for(int i=0;i<2;i++){ string p=s+t[i]; int c=press(p); if(c==n){ s+=t[i]; break; } } if((int) s.size() == n-1) s+=t[2]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...