Submission #1278937

#TimeUsernameProblemLanguageResultExecution timeMemory
1278937North1304Combo (IOI18_combo)C++20
100 / 100
9 ms596 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string ans; if (press("AB")) { if (press("A")) ans = "A"; else ans = "B"; } else { if (press("X")) ans = "X"; else ans = "Y"; } if (n==1) return ans; vector<string> test; if (ans!="A") test.push_back("A"); if (ans!="B") test.push_back("B"); if (ans!="X") test.push_back("X"); if (ans!="Y") test.push_back("Y"); for (int i=2;i<n;i++) { string s1 = ans + test[0]; string s2 = ans + test[1] + test[0]; string s3 = ans + test[1] + test[1]; string s4 = ans + test[1] + test[2]; int now = press(s1 + s2 + s3 + s4); if (now==i) ans += test[0]; else if (now==i+1) ans += test[1]; else if (now==i-1) ans += test[2]; } if (press(ans + "A" + ans + "B")==n) { if (press(ans + "A")==n) return ans + "A"; else return ans + "B"; } else { if (press(ans + "X")==n) return ans + "X"; else return ans + "Y"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...