Submission #1307235

#TimeUsernameProblemLanguageResultExecution timeMemory
1307235eyadoozCombo (IOI18_combo)C++20
0 / 100
1 ms400 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int) (x).size() #define endl '\n' string guess_sequence(int N) { string ans=""; string c="ABXY"; if(press("AB")) { if(press("A")) { c.erase(c.find('A'), 1); ans='A'; } else { c.erase(c.find('B'), 1); ans='B'; } } else { if(press("X")) { c.erase(c.find('X'), 1); ans='X'; } else { c.erase(c.find('Y'), 1); ans='Y'; } } if(N==1) return ans; for(int i = 1;i < N-1;i++) { string ask=ans+c[0]+c[0]+ans+c[0]+c[1]+ans+c[0]+c[2]+ans+c[1]; int len=press(ask); if(len==i) ans+=c[2]; else if(len==i+1)ans+=c[1]; else ans+=c[0]; } if(press(ans+"AB")) { if(press(ans+"A")) { ans+='A'; } else { ans+='B'; } } else { if(press(ans+"X")) { ans+='X'; } else { ans+='Y'; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...