제출 #368333

#제출 시각아이디문제언어결과실행 시간메모리
368333idontreallyknow콤보 (IOI18_combo)C++14
100 / 100
37 ms600 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { char one; int x = press("AB"); if (x > 0) { int y = press("A"); if (y == 1) one = 'A'; else one = 'B'; } else { int y = press("X"); if (y == 1) one = 'X'; else one = 'Y'; } string ans = ""; ans += one; vector<char> stuff = {'A','B','X','Y'}; vector<char> rem; for (char c : stuff) { if (c != one) rem.push_back(c); } for (int q = 2; q < N; q++) { string w = ""; for (int e = 0; e < 3; e++) { w += ans; w += rem[0]; w += rem[e]; } w += ans; w += rem[1]; w += one; int y = press(w); if (y == q+1) { ans += rem[0]; } else if (y == q) { ans += rem[1]; } else { ans += rem[2]; } } if (N == 1) return ans; string e = ""; for (int q = 0; q < 2; q++) { e += ans; e += rem[q]; } int r = press(e); if (r == N) { string t = ans; t += rem[0]; int y = press(t); if (y == N) ans += rem[0]; else ans += rem[1]; } else ans += rem[2]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...