# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1071694 | Rigobertus | Combo (IOI18_combo) | C++17 | 47 ms | 1100 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 <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
//#define int long long
#include "combo.h"
using namespace std;
string guess_sequence(int n) {
string c[4] = {"A", "B", "X", "Y"};
string s = "";
bool vis[4];
for (int i = 0; i < 4; i++) {
vis[i] = 0;
}
int j;
for (int i = 0; i < 4; i++) {
if (press(c[i])) {
s = c[i];
j = i;
break;
}
}
while (int(s.size()) < n) {
for (int i = 0; i < 4; i++) {
if (i == j || vis[i]) {
vis[i] = 0;
continue;
}
string p = s + c[i] + c[i];
if (press(p) == int(p.size())) {
s = p;
break;
}
else if (press(p) == int(p.size()) - 1) {
s += c[i];
vis[i] = 1;
break;
}
}
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |