Submission #990026

#TimeUsernameProblemLanguageResultExecution timeMemory
990026mannshah1211Combo (IOI18_combo)C++17
100 / 100
20 ms1912 KiB
/** * author: tourist * created: **/ #include "combo.h" #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif vector<string> alphabet = {"A", "B", "X", "Y"}; string guess_sequence(int n) { string firs = "?", ans; if (press("AB") >= 1) { if (press("A") == 1) { firs = "A"; } else { firs = "B"; } } else { if (press("X") == 1) { firs = "X"; } else { firs = "Y"; } } ans += firs; if (n == 1) { return ans; } vector<int> possible; for (int i = 0; i < 4; i++) { if (alphabet[i] != firs) { possible.push_back(i); } } for (int i = 1; i < n - 1; i++) { int x = press(ans + alphabet[possible[0]] + ans + alphabet[possible[1]] + alphabet[possible[0]] + ans + alphabet[possible[1]] + alphabet[possible[1]] + ans + alphabet[possible[1]] + alphabet[possible[2]]); if (x == i) { ans += alphabet[possible[2]]; } else if (x == i + 1) { ans += alphabet[possible[0]]; } else { ans += alphabet[possible[1]]; } } if (press(ans + alphabet[possible[0]]) == n) { ans += alphabet[possible[0]]; return ans; } if (press(ans + alphabet[possible[1]]) == n) { ans += alphabet[possible[1]]; return ans; } ans += alphabet[possible[2]]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...