Submission #685550

#TimeUsernameProblemLanguageResultExecution timeMemory
685550BliznetcCombo (IOI18_combo)C++17
100 / 100
42 ms544 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence (int N) { int n = N; vector<string> a = {"A", "B", "X", "Y"}; string ans = ""; int cur = press(a[0] + a[1]); if (cur) { cur = press(a[0]); if (cur) { ans += a[0]; swap(a[0], a[3]); } else { ans += a[1]; swap(a[1], a[3]); } } else { cur = press(a[2]); if (cur) { ans += a[2]; swap(a[2], a[3]); } else { ans += a[3]; } } for (int i = 2; i < n; i++) { cur = press(ans + a[0] + ans + a[1] + a[0] + ans + a[1] + a[1] + ans + a[1] + a[2]); if (cur == i) { ans += a[0]; } else { if (cur == i + 1) { ans += a[1]; } else { ans += a[2]; } } } if (n == 1) { return ans; } cur = press(ans + a[0] + ans + a[1]); if (cur == n) { cur = press(ans + a[0]); if (cur == n) { ans += a[0]; } else { ans += a[1]; } } else { ans += a[2]; } return ans; } //void solve(){ // //} // //signed main() { // ios_base::sync_with_stdio(false); // cin.tie(0); cout.tie(0); // int t = 1; // cin >> t; // while (t--) { // solve(); // cout << "\n"; // } //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...