Submission #1111473

#TimeUsernameProblemLanguageResultExecution timeMemory
1111473epicci23Combo (IOI18_combo)C++17
100 / 100
55 ms1564 KiB
#include "bits/stdc++.h" #include "combo.h" //#define int long long #define all(v) v.begin() , v.end() #define sz(a) (int)a.size() using namespace std; vector<char> v; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int ask(string s,int ekle){ s.push_back(v[ekle]); return press(s); } string guess_sequence(int n){ string res=""; if(n==1){ if(press("A")==1) return "A"; if(press("B")==1) return "B"; if(press("Y")==1) return "Y"; return "X"; } if(press("AB")>=1){ if(press("A")==1) res.push_back('A'); else res.push_back('B'); } else{ if(press("X")==1) res.push_back('X'); else res.push_back('Y'); } if(res!="A") v.push_back('A'); if(res!="B") v.push_back('B'); if(res!="X") v.push_back('X'); if(res!="Y") v.push_back('Y'); for(int i=1;i<n;i++){ if(i==n-1){ bool ok=0; shuffle(all(v),rng); for(int j=0;j<2;j++){ if(ask(res,j)==i+1){ res.push_back(v[j]); ok=1; break; } } if(!ok) res.push_back(v.back()); } else{ string Query=""; for(int i=0;i<3;i++){ Query+=res; Query.push_back(v[0]); Query.push_back(v[i]); } Query+=res; Query.push_back(v[1]); int hm = press(Query); if(hm==i) res.push_back(v[2]); else if(hm==i+1) res.push_back(v[1]); else res.push_back(v[0]); } } return res; } /*void _(){ } int32_t main(){ cin.tie(0); ios::sync_with_stdio(0); int tc=1;//cin >> tc; while(tc--) _(); return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...