제출 #362180

#제출 시각아이디문제언어결과실행 시간메모리
362180Eyed콤보 (IOI18_combo)C++14
100 / 100
62 ms548 KiB
#include <iostream> #include <algorithm> #include <vector> #include <string> using namespace std; int press(string s); string guess_sequence(int N) { if (N == 1) { int tmp = press("AB"); if (tmp == 1) { int ttmp = press("A"); if (ttmp == 1) return "A"; else return "B"; } int ttmp = press("X"); if (ttmp == 1) return "X"; return "Y"; } string pre = ""; char first; int tmp = press("AB"); if (tmp >= 1) { int ttmp = press("A"); if (ttmp == 1) first = 'A'; else first = 'B'; } else { int ttmp = press("X"); if (ttmp == 1) first = 'X'; else first = 'Y'; } pre += first; for (int i = 1; i < N - 1; ++i) { if (first == 'A' || first == 'B') { string put = ""; put += pre; put += 'X'; put += pre; put += 'Y'; put += 'Y'; put += pre; put += 'Y'; put += 'X'; put += pre; put += 'Y'; if (first == 'A') put += 'B'; else put += 'A'; int preLen = press(put); if (preLen == i) { if (first == 'A') pre += 'B'; else pre += 'A'; } else if (preLen == i + 1) pre += 'X'; else if (preLen == i + 2) pre += 'Y'; continue; } string put = ""; put += pre; put += 'A'; put += pre; put += 'B'; put += 'B'; put += pre; put += 'B'; put += 'A'; put += pre; put += 'B'; if (first == 'X') put += 'Y'; else put += 'X'; int preLen = press(put); if (preLen == i) { if (first == 'X') pre += 'Y'; else pre += 'X'; } else if (preLen == i + 1) pre += 'A'; else if (preLen == i + 2) pre += 'B'; } if (first == 'A' || first == 'B') { string put1 = pre; string put2 = pre; put1 += 'X'; put2 += 'Y'; if (press(put1) == N) { pre += 'X'; return pre; } if (press(put2) == N) { pre += 'Y'; return pre; } if (first == 'A') { pre += 'B'; return pre; } else { pre += 'A'; return pre; } } else { string put1 = pre; string put2 = pre; put1 += 'A'; put2 += 'B'; if (press(put1) == N) { pre += 'A'; return pre; } if (press(put2) == N) { pre += 'B'; return pre; } if (first == 'X') { pre += 'Y'; return pre; } else { pre += 'X'; return pre; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...