Submission #1023384

#TimeUsernameProblemLanguageResultExecution timeMemory
1023384vaneaCombo (IOI18_combo)C++14
100 / 100
23 ms2104 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; using ll = long long; string guess_sequence(int n) { vector<string> pos = {"A", "B", "X", "Y"}; string ans = ""; if(press("AB")) { if(press("A")) ans += "A"; else ans += "B"; } else { if(press("X")) ans += "X"; else ans += "Y"; } int last = 1; string res = string(1, ans[0]); for(int i = 1; i < n; i++) { string f = "", s = "", t = ""; for(auto it : pos) { if(it == res) continue; if(f == "") f = it; else if(s == "") s = it; else t = it; } if(i == n-1) { string curr = ans + f + ans + s; if(press(curr) == last+1) { if(press(ans+f) == last+1) ans += f; else ans += s; } else ans += t; } else { string curr = ans + f + s + ans + f + f + ans + f + t + ans + s; int k = press(curr); if(k == last+2) { ans += f; } else if(k == last+1) { ans += s; } else ans += t; } ++last; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...