# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1072577 | Rigobertus | Combo (IOI18_combo) | C++17 | 1 ms | 344 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;
if (press("AB")) {
s = "B";
if (press("A")) {
s = "A";
}
}
else {
s = "X";
if (press("Y")) {
s = "Y";
}
}
vector<int> a;
for (int i = 0; i < 4; i++) {
if (c[i] != s) {
a.push_back(i);
}
}
while (s.size() < n - 1) {
string p = s + c[a[0]];
for (int i = 0; i < 3; i++) {
p += s + c[a[1]] + c[a[i]];
}
int x = press(p);
if (x == s.size()) {
s += c[a[2]];
}
else if (x == s.size() + 1) {
s += c[a[0]];
}
else {
s += c[a[1]];
}
}
string ans = s;
if (press(s + "A" + s + "B") == n) {
ans = s + "A";
if (press(s + "B")) {
ans = s + "B";
}
}
else {
ans = s + "X";
if (press(s + "Y") == n) {
ans = s + "Y";
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |