# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
412681 | snasibov05 | Combo (IOI18_combo) | C++14 | 86 ms | 564 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "combo.h"
#include <vector>
using namespace std;
#define pb push_back
string guess_sequence(int n) {
vector<vector<bool>> v(n, vector<bool>(4, true));
string ans;
int cur = 0;
while (cur < n){
int k = cur;
string str = ans;
while (k < n){
if (v[k][0]) str.pb('A');
else if (v[k][1]) str.pb('B');
else if (v[k][2]) str.pb('X');
else str.pb('Y');
k++;
}
int x = press(str);
if (cur == 0 && x > 0){
for (int i = 0; i < n; ++i) {
if (str[0] == 'A') v[i][0] = false;
else if (str[0] == 'B') v[i][1] = false;
else if (str[0] == 'X') v[i][2] = false;
else v[i][3] = false;
}
}
for (int i = ans.size(); i < x; ++i) {
ans += str[i];
cur++;
}
if (x < str.size()){
if (str[x] == 'A') v[x][0] = false;
else if (str[x] == 'B') v[x][1] = false;
else if (str[x] == 'X') v[x][2] = false;
else v[x][3] = false;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |