Submission #1023377

#TimeUsernameProblemLanguageResultExecution timeMemory
1023377vaneaCombo (IOI18_combo)C++14
0 / 100
0 ms596 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++) { if(i == n-1) { string curr = "", last1 = ""; for(auto it : pos) { if(it == res) continue; if(curr.length() == ans.length()+2) { last1 = ans+it; } else { curr += ans; curr += it; } } if(press(curr) == last+1) { string curr1 = ans + curr[ans.length()]; string curr2 = ans + curr[curr.length()-1]; if(press(curr1) == last+1) ans += curr[ans.length()]; else ans += curr[curr.length()-1]; } else { ans += last1[last1.length()-1]; } } else { string f = "", s = "", t = ""; for(auto it : pos) { if(it == res) continue; if(f == "") f = it; else if(s == "") s = it; else t = it; } 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; } if((int)ans.length() != n) { while(1) {} } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...