# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
900126 | Omar_Elgedawy | Combo (IOI18_combo) | C++17 | 22 ms | 1768 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 <bits/stdc++.h>
using namespace std;
mt19937 mt(time(nullptr));
string guess_sequence(int n) {
vector<char> chr;
chr.push_back('A');
chr.push_back('B');
chr.push_back('X');
chr.push_back('Y');
string cur = "";
for (int i = 0; i < 4; i++) {
cur=chr[i];
if (press(cur)) {
break;
}
}
for (int i = 2; i <= n; i++) {
string tst[3] = {cur, cur, cur};
for (int k = 0, j = 0; j < 4; j++) {
if (chr[j] == cur[0]) {
continue;
}
tst[k] += chr[j];
k++;
}
int f = mt() % 3;
int s = mt() % 3;
int th = 0;
while (s == f)s = mt() % 3;
for (int k = 0; k < 3; k++) {
if (k != f && k != s) {
th = k;
break;
}
}
// cout<<tst[f]<<' '<<tst[s]<<endl;
if (press(tst[f] + tst[s]) == tst[f].size()) {
if (press(tst[f]) == tst[f].size()) {
cur += tst[f].back();
} else
cur += tst[s].back();
} else {
cur += tst[th].back();
}
}
// cout<<cur<<el;
return cur;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |