Submission #596794

#TimeUsernameProblemLanguageResultExecution timeMemory
596794BelphegorCombo (IOI18_combo)C++14
0 / 100
1 ms208 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string C = "ABXY"; string guess_sequence(int n){ string s = "AB"; if(press(s)){ s = "A"; if(!press(s)) s = "B"; } else{ s = "X"; if(!press(s)) s = "Y"; } string S[3]; for(int i=0; i<3; i++) S[i] = s; for(int i=0; C[i]; i++) if(C[i]==s[0]){ C.erase(C.begin()+i); break; } int score = 3; for(int i=1; i<n; i++){ S[0].push_back(C[0]); S[1].push_back(C[0]); S[2].push_back(C[1]); int nxt = press(S[0]+S[1]+S[2]); char ch; if(nxt==score) ch = C[2]; else if(nxt==score+1) ch = C[1]; else ch = C[0]; score = nxt; for(int j=0; j<3; j++) S[j].back() = ch; } return S[0]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...