Submission #321031

#TimeUsernameProblemLanguageResultExecution timeMemory
321031gustasonCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string keys[] = {"A", "B", "X", "Y"}; string S = ""; if (press("AB") == 1) { if (press("A") == 1) { S += 'A'; } else { S += 'B'; } } else { if (press("X") == 1) { S += 'X'; } else { S += 'Y'; } } vector<string> add; if (S == "B") { add.push_back("X"); } else { add.push_back("B"); } string fr; if (S == "X") { fr += "B"; } else { fr += "X"; } vector<string> keys2; for(int i = 0; i < 4; i++) { if (keys[i] == S) continue; keys2.push_back(keys[i]); add.push_back(fr + keys[i]); } int sz = 1; for(int i = 1; i < N-1; i++, sz++) { int p = press(S + add[0] + S + add[1] + S + add[2] + S + add[3]); if (p == sz) { S += add[3][1]; } else if (p == sz + 1) { S += add[0][0]; } else { S += add[1][0]; } } if (press(S + keys[0] + S + keys[1]) == sz) { S += keys[2]; } else { if (press(S + keys[0]) == sz + 1) { S += keys[0]; } else { S += keys[1]; } } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...