제출 #158118

#제출 시각아이디문제언어결과실행 시간메모리
158118johutha콤보 (IOI18_combo)C++14
5 / 100
93 ms556 KiB
#include "combo.h" #include <vector> using namespace std; string guess_sequence(int N) { string curr = ""; string other; if (press("AB")) { if (press("A")) { curr.push_back('A'); other = "BXY"; } else { curr.push_back('B'); other = "AXY"; } } else { if (press("X")) { curr.push_back('X'); other = "ABY"; } else { curr.push_back('Y'); other = "ABX"; } } if (N == 1) return curr; for (int i = 1; i < N - 1; i++) { string ask = curr + other[0] + curr + other[1] + other[0] + curr + other[1] + other[1] + curr + other[1] + other[2]; int res = press(ask); if (res == i) { curr.push_back(other[2]); } else if (res == i + 1) { curr.push_back(other[0]); } else { curr.push_back(other[1]); } } if (press(curr + other[0] + curr + other[1]) != N) { return curr + other[2]; } else if (press(curr + other[0]) == N) return curr + other[0]; return curr + other[1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...