Submission #1037952

#TimeUsernameProblemLanguageResultExecution timeMemory
1037952RecursiveCoCombo (IOI18_combo)C++17
100 / 100
22 ms2232 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define in(i) cin >> i #define out(o) cout << o string guess_sequence(int N) { string ans = ""; int first = press("AB"); vector<string> left; if (first) { first = press("A"); if (first) ans += "A", left.push_back("B"), left.push_back("X"), left.push_back("Y"); else ans += "B", left.push_back("A"), left.push_back("X"), left.push_back("Y"); } else { first = press("X"); if (first) ans += "X", left.push_back("B"), left.push_back("A"), left.push_back("Y"); else ans += "Y", left.push_back("B"), left.push_back("X"), left.push_back("A"); } for (int i = 0; i < N - 2; i++) { string inp = (ans + left[0]) + (ans + left[1] + left[0]) + (ans + left[1] + left[1]) + (ans + left[1] + left[2]); int res = press(inp); if (res == i + 1) { ans += left[2]; } else if (res == i + 2) { ans += left[0]; } else { ans += left[1]; } } if (N != 1) { int last = press(ans + left[0]); if (last == N) ans += left[0]; else { last = press(ans + left[1]); if (last == N) ans += left[1]; else ans += left[2]; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...