제출 #769162

#제출 시각아이디문제언어결과실행 시간메모리
769162pashka콤보 (IOI18_combo)C++14
100 / 100
24 ms564 KiB
#include "combo.h" char guess_first_letter() { int x = press("AB"); if (x > 0) { int y = press("A"); if (y > 0) { return 'A'; } else { return 'B'; } } else { int y = press("X"); if (y > 0) { return 'X'; } else { return 'Y'; } } } std::string guess_sequence(int N) { std::string s; s += guess_first_letter(); if (N == 1) { return s; } std::string chars; for (char c : "ABXY") { if (c != s[0]) chars += c; } for (int i = 0; i < N - 2; i++) { int x = press( s + chars[0] + chars[0] + s + chars[0] + chars[1] + s + chars[0] + chars[2] + s + chars[1]); if (x == (int)s.size()) { s += chars[2]; } else if (x == (int)s.size() + 1) { s += chars[1]; } else { s += chars[0]; } } int x = press(s + chars[0] + s + chars[1]); if (x == N) { x = press(s + chars[0]); if (x == N) { return s + chars[0]; } else { return s + chars[1]; } } else { return s + chars[2]; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...