제출 #161141

#제출 시각아이디문제언어결과실행 시간메모리
161141InkretBear콤보 (IOI18_combo)C++14
100 / 100
96 ms564 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int n) { int q=press("AB"); int 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]); if (n==1){ return res; } 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...