Submission #1012988

#TimeUsernameProblemLanguageResultExecution timeMemory
1012988aufanCombo (IOI18_combo)C++17
100 / 100
20 ms2072 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string ans = ""; vector<string> ask; if (press("AB") >= 1) { if (press("A")) { ans += "A"; ask = {"B", "X", "Y"}; } else { ans += "B"; ask = {"A", "X", "Y"}; } } else { if (press("X")) { ans += "X"; ask = {"A", "B", "Y"}; } else { ans += "Y"; ask = {"A", "B", "X"}; } } if (N == 1) return ans; for (int i = 2; i <= N - 1; i++) { string x = ans + ask[0]; string tp = ""; for (int j = 0; j < 3; j++) { tp += x + ask[j]; } tp += ans + ask[1]; int ret = press(tp); if (ret == i + 1) ans += ask[0]; else if (ret == i) ans += ask[1]; else if (ret == i - 1) ans += ask[2]; } if (press(ans + ask[0]) == N) ans += ask[0]; else if (press(ans + ask[1]) == N) ans += ask[1]; else ans += ask[2]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...