Submission #94702

#TimeUsernameProblemLanguageResultExecution timeMemory
94702ToadDaveskiCombo (IOI18_combo)C++14
100 / 100
56 ms588 KiB
#include "combo.h" #include <bits/stdc++.h> #define ll long long std::string guess_sequence(int N) { std::string s=""; std::map <char,ll> us; if (N==1) { if (press("A")) return "A"; if (press("B")) return "B"; if (press("X")) return "X"; return "Y"; } ll t1=press("AB"); if (t1) { if (press("A")) { us['A']=1; s="A"; } else { us['B']=1; s="B"; } } else { if (press("X")) { us['X']=1; s="X"; } else { us['Y']=1; s='Y'; } } std::vector <char> nx; if (!us['A']) nx.push_back('A'); if (!us['B']) nx.push_back('B'); if (!us['X']) nx.push_back('X'); if (!us['Y']) nx.push_back('Y'); for(ll i=2;i<N;i++) { std::string fp=""; fp=(s+nx[0]); fp+=(s+nx[1]+nx[0]); fp+=(s+nx[1]+nx[1]); fp+=(s+nx[1]+nx[2]); ll t=press(fp); if (t==i-1) s+=nx[2]; if (t==i) s+=nx[0]; if (t==i+1) s+=nx[1]; } if (press(s+nx[0])==N) s+=nx[0]; else { if (press(s+nx[1])==N) s+=nx[1]; else s+=nx[2]; } //cout<<s<<endl; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...