Submission #421433

#TimeUsernameProblemLanguageResultExecution timeMemory
421433priority_queueCombo (IOI18_combo)C++17
100 / 100
53 ms500 KiB
#include <bits/stdc++.h> #define forint(i, N) for (int i = 0; i < (N); i++) using namespace std; int press(string p); string guess_sequence(int N) { string ans = ""; vector<char> v; if (N == 1) { if (press("A") == 1) { ans += 'A'; v = {'B', 'X', 'Y'}; } else if (press("B") == 1) { ans += 'B'; v = {'A', 'X', 'Y'}; } else if (press("X") == 1) { ans += 'X'; v = {'A', 'B', 'Y'}; } else { ans += 'Y'; v = {'A', 'B', 'X'}; } return ans; } int tmp = press("AB"); if (tmp == 0){ if (press("X") == 1) { ans += 'X'; v = {'A', 'B', 'Y'}; } else { ans += 'Y'; v = {'A', 'B', 'X'}; } } else if (tmp == 1) { if (press("A") == 1) { ans += 'A'; v = {'B', 'X', 'Y'}; } else { ans += 'B'; v = {'A', 'X', 'Y'}; } } else { ans += 'A'; v = {'B', 'X', 'Y'}; } //int pos = 1; for (int i = 1; i < N - 1; i++) { int tmp = press(ans + v[0] + ans + v[1] + v[0] + ans + v[1] + v[1] + ans + v[1] + v[2]); if (tmp == i + 1) { ans += v[0]; } else if (tmp == i + 2) { ans += v[1]; } else { ans += v[2]; } } if (press(ans + v[0]) == N) { ans += v[0]; } else if (press(ans + v[1]) == N) { ans += v[1]; } else { ans += v[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...