Submission #166952

#TimeUsernameProblemLanguageResultExecution timeMemory
166952williamMBDKCombo (IOI18_combo)C++14
100 / 100
61 ms592 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string S; vector<char> cs; if(press("AB") > 0){ if(press("A") == 1){ S = "A"; cs = {'B', 'X', 'Y'}; }else{ S = "B"; cs = {'A', 'X', 'Y'}; } }else{ if(press("X") == 1){ S = "X"; cs = {'B', 'A', 'Y'}; }else{ S = "Y"; cs = {'B', 'X', 'A'}; } } //cout << S << endl; if(N == 1) return S; for(int i = 1; i < N-1; i++){ string p = S + cs[0] + S + cs[1] + cs[0] + S + cs[1] + cs[1] + S + cs[1] + cs[2]; int c = press(p); if(c == i){ S += cs[2]; }else if(c == i + 1){ S += cs[0]; }else{ S += cs[1]; } } if(press(S + "A" + S + "B") == N){ if(press(S + "A") == N){ S += "A"; }else{ S += "B"; } }else{ if(press(S + "X") == N){ S += "X"; }else{ S += "Y"; } } //cout << S << endl; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...