Submission #775587

#TimeUsernameProblemLanguageResultExecution timeMemory
7755871binCombo (IOI18_combo)C++14
100 / 100
27 ms572 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; string str; int x; string guess_sequence(int n){ string S; if(press("AB")){ x = press("A"); S = x ? "A" : "B"; } else{ x = press("X"); S = x ? "X" : "Y"; } if(n == 1) return S; for(auto c : "ABXY") if(c != S[0]) str += c; for(int i = 1; i < n - 1; i++){ string s = S + str[0] + S + str[1] + str[0] + S + str[1] + str[1] + S + str[1] + str[2]; x = press(s); if(x == i) S += str[2]; else if(x == i + 1) S += str[0]; else S += str[1]; } x = press(S + str[0]); if(x == n) S += str[0]; else{ x = press(S + str[1]); if(x == n) S += str[1]; else S += str[2]; } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...