Submission #914761

#TimeUsernameProblemLanguageResultExecution timeMemory
914761SmuggingSpunCombo (IOI18_combo)C++17
0 / 100
1 ms596 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { string ans; int cnt = press("AB"); if(cnt == 2){ ans = "A"; } else if(cnt == 1){ ans = (press("A") == 1 ? "A" : "B"); } else{ ans = (press("C") == 1 ? "C" : "D"); } string query = "ABXY"; for(int i = 0; i < 4; i++){ if(query[i] == ans[0]){ query.erase(i, 1); break; } } for(int i = 1; i < n - 1; i++){ int index = press(ans + query[0] + query[0] + ans + query[0] + query[1] + ans + query[0] + query[2] + ans + query[1]); ans += query[2 - index + int(ans.size())]; } for(int i = 0; i < 2; i++){ if(press(ans + query[i]) == n){ return ans + query[i]; } } return ans + query[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...