제출 #861697

#제출 시각아이디문제언어결과실행 시간메모리
861697Ariadna콤보 (IOI18_combo)C++14
100 / 100
15 ms1980 KiB
#include <bits/stdc++.h> using namespace std; int press(string p); vector < char > aux; string first_char() { string s = "AB"; if (press(s)) { s = "A"; if (press(s)) { aux = {'B', 'X', 'Y'}; return s; } aux = {'A', 'X', 'Y'}; return "B"; } s = "X"; if (press(s)) { aux = {'A', 'B', 'Y'}; return s; } aux = {'A', 'B', 'X'}; return "Y"; } string guess_sequence(int N) { string s = first_char(); for (int i = 2; i < N; ++i) { string q = s + aux[0] + aux[0] + s + aux[0] + aux[1] + s + aux[0] + aux[2] + s + aux[1]; int ans = press(q); if (ans == i + 1) s += aux[0]; else if (ans == i) s += aux[1]; else s += aux[2]; } if (N > 1) { s += aux[0]; if (press(s) == N) return s; s[N - 1] = aux[1]; if (press(s) == N) return s; s[N - 1] = aux[2]; return s; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...