제출 #1317978

#제출 시각아이디문제언어결과실행 시간메모리
131797812345678콤보 (IOI18_combo)C++17
100 / 100
8 ms592 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string res; vector<char> op={'A', 'B', 'X', 'Y'}, new_op; // new_op contains only the one not in first character char st; if (press("AB")) { if (press("A")) st='A'; else st='B'; } else { if (press("X")) st='X'; else st='Y'; } res=st; if (N==1) return res; for (int i=0; i<4; i++) if (st!=op[i]) new_op.push_back(op[i]); for (int i=1; i<N-1; i++) { string s=(res+new_op[0])+(res+new_op[1]+new_op[0])+(res+new_op[1]+new_op[1])+(res+new_op[1]+new_op[2]); int p=press(s); if (p==res.size()) res+=new_op[2]; else if (p==res.size()+1) res+=new_op[0]; else res+=new_op[1]; } for (int i=0; i<2; i++) if (press(res+new_op[i])==N) return res+new_op[i]; return res+new_op[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...