제출 #230963

#제출 시각아이디문제언어결과실행 시간메모리
230963peijar콤보 (IOI18_combo)C++17
100 / 100
42 ms596 KiB
#include <bits/stdc++.h> using namespace std; int press(string p); string guess_sequence(int len) { string ret = ""; string keys = "ABXY"; char first_car; if (press("AB")) { if (press("A")) first_car = 'A'; else first_car = 'B'; } else { if (press("X")) first_car = 'X'; else first_car = 'Y'; } ret += first_car; string keys_left = ""; for (auto c : keys) if (c != first_car) keys_left += c; for (int nb_trouve(2); nb_trouve < len; ++nb_trouve) { string ask = ""; for (auto c : keys_left) ask += ret + keys_left[0] + c; ask += ret + keys_left[1]; int nb = press(ask); if (nb == nb_trouve - 1) ret += keys_left[2]; if (nb == nb_trouve) ret += keys_left[1]; if (nb == nb_trouve + 1) ret += keys_left[0]; } if (len > 1) { if (press(ret + keys_left[0]) == len) ret += keys_left[0]; else { if (press(ret + keys_left[1]) == len) ret += keys_left[1]; else ret += keys_left[2]; } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...