Submission #961546

#TimeUsernameProblemLanguageResultExecution timeMemory
961546mannshah1211Combo (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include <combo.h> #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string s; string a[4] = {"A", "B", "X", "Y"}; int fr = -1; for (int j = 0; j < 4; j++) { if (press(a[j]) == 1) { s += a[j]; fr = j; } } for (int i = 1; i < n; i++) { int cnt = 0, ind = -1, lst = -1; for (int j = 0; j < 4; j++) { if (j != fr && cnt < 2) { cnt++; if (cnt == 2) { lst = j; } if (press(s + a[j]) == i) { ind = j; } } } if (ind != -1) { s += a[ind]; } else { for (int j = lst + 1; j < 4; j++) { if (j != fr) { s += a[j]; } } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...