Submission #867752

#TimeUsernameProblemLanguageResultExecution timeMemory
867752ElenaBMCombo (IOI18_combo)C++17
100 / 100
14 ms1952 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence (int N){ vector<char>sec(3); string ans = ""; if (press("AB") > 0){ if (press("A")) { ans += 'A'; sec[0] = 'B'; } else { ans += 'B'; sec[0] = 'A'; } sec[1] = 'X'; sec[2] = 'Y'; } else{ sec[0] = 'A'; sec[1] = 'B'; if (press("X")) { ans += 'X'; sec[2] = 'Y'; } else { ans += 'Y'; sec[2] = 'X'; } } if (N == 1) return ans; for (int i = 2; i < N; ++i){ string guess = ans + sec[0] + ans + sec[1] + sec[0] + ans + sec[1] + sec[1] + ans + sec[1] + sec[2]; int x = press(guess); if (x == i) ans += sec[0]; else if (x == i+1) ans += sec[1]; else ans += sec[2]; } string fguess = ans + sec[0]; if (press(ans+sec[0]) == N)ans += sec[0]; else if (press(ans+sec[1]) == N) ans += sec[1]; else ans += sec[2]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...