Submission #468204

#TimeUsernameProblemLanguageResultExecution timeMemory
468204Soumya1Combo (IOI18_combo)C++17
100 / 100
37 ms556 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string s = ""; string choice = "ABXY"; if (press(choice.substr(0, 2))) { if (press(string(1, choice[0]))) s += choice[0]; else s += choice[1]; } else { if (press(string(1, choice[2]))) s += choice[2]; else s += choice[3]; } int idx = choice.find(s[0]); choice.erase(choice.begin() + idx); for (int i = 1; i < n - 1; i++) { string ask = s + choice[0] + s + choice[1] + choice[0] + s + choice[1] + choice[1] + s + choice[1] + choice[2]; int res = press(ask); if (res == i) s += choice[2]; else if (res == i + 1) s += choice[0]; else s += choice[1]; } if (n == 1) return s; if (press(s + choice[0]) == n) s += choice[0]; else if (press(s + choice[1]) == n) s += choice[1]; else s += choice[2]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...