Submission #523456

#TimeUsernameProblemLanguageResultExecution timeMemory
523456dron_rpCombo (IOI18_combo)C++14
5 / 100
1 ms212 KiB
#include "combo.h" #include <set> #include <iostream> using namespace std; string guess_sequence(int N) { string S = ""; set<char> a = {'A', 'B', 'X', 'Y'}; string p = ""; if (press("A") == 1){ a.erase('A'); S += 'A'; } else if (press("B") == 1){ a.erase('B'); S += 'B'; } else if (press("X") == 1){ a.erase('X'); S += 'X'; } else{ a.erase('Y'); S += 'Y'; } char v[3]; int idx = 0; if (a.count('A')) v[idx++] = 'A'; if (a.count('B')) v[idx++] = 'B'; if (a.count('X')) v[idx++] = 'X'; if (a.count('Y')) v[idx++] = 'Y'; while ((int) S.size() < N-1){ p = S + v[0] + S + v[1]+v[0] + S + v[1]+v[1] + S + v[1]+v[2]; int coins = press(p); if (coins == (int)S.size()){ S += v[2]; } else if (coins == (int)S.size()+1){ S += v[0]; } else{ S += v[1]; } } if (press(S+v[0]) == N){ S += v[0]; } else if (press(S+v[1]) == N){ S += v[1]; } else{ S += v[2]; } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...