제출 #616781

#제출 시각아이디문제언어결과실행 시간메모리
616781pirhosig콤보 (IOI18_combo)C++17
100 / 100
37 ms584 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { char que[3]; string ret = ""; if (press("AB")) { que[0] = 'X'; que[1] = 'Y'; if (press("A")) { que[2] = 'B'; ret = "A"; } else { que[2] = 'A'; ret = "B"; } } else { que[0] = 'A'; que[1] = 'B'; if (press("X")) { que[2] = 'Y'; ret = "X"; } else { que[2] = 'X'; ret = "Y"; } } if (N == 1) return ret; // cerr << "S " << ret << " " << que[0] << " " << que[1] << " " << que[2] << endl; for (int i = 0; i < N - 2; ++i) { string query = ret + que[0] + que[0] + ret + que[0] + que[1] + ret + que[0] + que[2] + ret + que[1]; // cerr << "T " << query << " " << query.size() << endl; int res = press(query); int s = (int)(ret.size()); if (res == s) ret += que[2]; else if (res == s + 1) ret += que[1]; else ret += que[0]; // cerr << "N " << ret << endl; } if (press(ret + que[0]) == N) ret += que[0]; else if (press(ret + que[1]) == N) ret += que[1]; else ret += que[2]; // cerr << ret << endl; return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...