Submission #262134

#TimeUsernameProblemLanguageResultExecution timeMemory
262134RainbowbunnyCombo (IOI18_combo)C++17
100 / 100
78 ms620 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; map <char, char> M; string guess_sequence(int n) { string ans; M['A'] = 'A'; M['B'] = 'B'; M['X'] = 'X'; M['Y'] = 'Y'; int a = press("AX"); if(a > 0) { int b = press("A"); if(b > 0) { ans.push_back('A'); } else { ans.push_back('X'); } } else { int b = press("Y"); if(b > 0) { ans.push_back('Y'); } else { ans.push_back('B'); } } swap(M[ans[0]], M['Y']); for(int i = 1; i < n; i++) { if(i == n - 1) { string temp = ans; temp.push_back(M['A']); int cnt = press(temp); if(cnt == n) { return temp; } temp.back() = M['B']; cnt = press(temp); if(cnt == n) { return temp; } ans.push_back(M['X']); return ans; } else { string temp; temp = ans; temp.push_back(M['A']); temp.push_back(M['B']); for(auto x : ans) { temp.push_back(x); } temp.push_back(M['A']); temp.push_back(M['A']); for(auto x : ans) { temp.push_back(x); } temp.push_back(M['A']); temp.push_back(M['X']); for(auto x : ans) { temp.push_back(x); } temp.push_back(M['B']); int cnt = press(temp); if(cnt == i) { ans.push_back(M['X']); } else if(cnt == i + 1) { ans.push_back(M['B']); } else { ans.push_back(M['A']); } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...