Submission #161140

#TimeUsernameProblemLanguageResultExecution timeMemory
161140InkretBearCombo (IOI18_combo)C++14
5 / 100
2 ms276 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ int q=press("AB"),w=press("AX"); char s[4]={'A','B','X','Y'}; if (q && w){ swap(s[0],s[3]); } if (q && !w){ swap(s[1],s[3]); } if (!q && w){ swap(s[2],s[3]); } string res,u; res.push_back(s[3]); for (int i=1;i<n-1;++i){ u.clear(); for (int j=0;j<i;++j){ u.push_back(res[j]); } u.push_back(s[1]); for (int j=0;j<i;++j){ u.push_back(res[j]); } u.push_back(s[0]); u.push_back(s[0]); for (int j=0;j<i;++j){ u.push_back(res[j]); } u.push_back(s[0]); u.push_back(s[2]); for (int j=0;j<i;++j){ u.push_back(res[j]); } u.push_back(s[0]); u.push_back(s[1]); q=press(u); if (q==i){ res.push_back(s[2]); } if (q==i+1){ res.push_back(s[1]); } if (q==i+2){ res.push_back(s[0]); } } u.clear(); for (int i=0;i<n-1;++i){ u.push_back(res[i]); } u.push_back(s[0]); q=press(u); u.clear(); for (int i=0;i<n-1;++i){ u.push_back(res[i]); } u.push_back(s[1]); w=press(u); if (q==n){ res.push_back(s[0]); } else if (w==n){ res.push_back(s[1]); } else { res.push_back(s[2]); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...