Submission #336601

#TimeUsernameProblemLanguageResultExecution timeMemory
336601ljubaCombo (IOI18_combo)C++17
100 / 100
48 ms544 KiB
#include <bits/stdc++.h> #include "combo.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<char> kar; if(ans != "A")kar.push_back('A'); if(ans != "B")kar.push_back('B'); if(ans != "X")kar.push_back('X'); if(ans != "Y")kar.push_back('Y'); for(int i = 1; i < n-1; ++i) { string s = ans + kar[0] + ans + kar[1] + kar[0] + ans + kar[1] + kar[1] + ans + kar[1] + kar[2]; int x = press(s); if(x == i) { ans += kar[2]; } else if(x == i+1) { ans += kar[0]; } else { ans += kar[1]; } } if(press(ans+kar[0]) == n) { ans += kar[0]; } else if(press(ans+kar[1]) == n) { ans += kar[1]; } else { ans += kar[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...