Submission #236192

#TimeUsernameProblemLanguageResultExecution timeMemory
236192davi_bartCombo (IOI18_combo)C++14
100 / 100
38 ms592 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; #define o_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> //#define int ll mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int press(string p); string guess_sequence(int N){ vector<char> k={'A','B','X','Y'}; string sol=""; int a=press("AB"); if(a){ int b=press("A"); if(b){ sol="A"; k.erase(k.begin()); }else{ sol="B"; k.erase(k.begin()+1); } }else{ int b=press("X"); if(b){ sol="X"; k.erase(k.begin()+2); }else{ sol="Y"; k.erase(k.begin()+3); } } if(N==1)return sol; for(int i=1;i<N-1;i++){ int z=press(sol+k[0]+k[0]+sol+k[0]+k[1]+sol+k[0]+k[2]+sol+k[1]); if(z==i)sol+=k[2]; else if(z==(i+1))sol+=k[1]; else sol+=k[0]; } a=press(sol+k[0]+sol+k[1]); if(a==N-1)return sol+k[2]; a=press(sol+k[0]); if(a==N)return sol+k[0]; return sol+k[1]; } /* signed main(){ ios_base::sync_with_stdio(0);cin.tie(0); cout<<guess_sequence(5); }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...