제출 #1317896

#제출 시각아이디문제언어결과실행 시간메모리
1317896theem1502Combo (IOI18_combo)C++20
5 / 100
0 ms332 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { //string p = ""; /* for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; } */ string ans; int num = press("A"); int secondnum = press("B"); int thirdnum = press("X"); if (num == 1) { ans += 'A'; } else if (secondnum == 1) { ans += 'B'; } else if (thirdnum == 1) { ans += 'X'; } else { ans += 'Y'; } char forbidden = ans[0]; char first, second, third; if (forbidden == 'A') { first = 'B', second = 'Y', third = 'X'; } if (forbidden == 'B') { first = 'A', second = 'X', third = 'Y'; } if (forbidden == 'X') { first = 'A', second = 'B', third = 'Y'; } if (forbidden == 'Y') { first = 'A', second = 'B', third = 'X'; } while(ans.length() < N - 1) { int y = press(ans + first + ans + second + first + ans + second + second + ans + second + third); if (y == ans.length()) { ans += third; } if (y == ans.length() + 1) { ans += first; } if (y == ans.length() +2) { ans += second; } } int val = press(ans + first); int secondval = press(ans + second); if (val == ans.length() + 1) { ans += first; } else if (secondval == ans.length() + 1) { ans += second; } else { ans += third; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...