Submission #991554

#TimeUsernameProblemLanguageResultExecution timeMemory
991554LalicCombo (IOI18_combo)C++17
100 / 100
23 ms1948 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define mp make_pair typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; string guess_sequence(int N) { char prim; string curr=""; int aux=press("AB"); if(aux){ aux=press("A"); if(aux) prim='A'; else prim='B'; } else{ aux=press("X"); if(aux) prim='X'; else prim='Y'; } curr+=prim; if(N==1) return curr; vector<char> vals; if(prim=='A') vals={'B', 'X', 'Y'}; else if(prim=='B') vals={'A', 'X', 'Y'}; else if(prim=='X') vals={'A', 'B', 'Y'}; else vals={'A', 'B', 'X'}; for(int i=2;i<N;i++){ string q=(curr+vals[0])+(curr+vals[1]+vals[0])+(curr+vals[1]+vals[1])+(curr+vals[1]+vals[2]); int at=press(q); if(at==i-1) curr+=vals[2]; else if(at==i) curr+=vals[0]; else curr+=vals[1]; } aux=press(curr+vals[0]); if(aux==N) curr+=vals[0]; else{ aux=press(curr+vals[1]); if(aux==N) curr+=vals[1]; else curr+=vals[2]; } return curr; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...