# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
75727 | Markomafko972 | Combo (IOI18_combo) | C++14 | 66 ms | 556 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;
string guess_sequence(int N) {
string sol = "";
vector<char> v;
if (press("AB") >= 1) {
if (press("A") == 1) sol += 'A';
else sol += 'B';
}
else {
if (press("X") == 1) sol += 'X';
else sol += 'Y';
}
if (N == 1) return sol;
if (sol[0] != 'A') v.push_back('A');
if (sol[0] != 'B') v.push_back('B');
if (sol[0] != 'X') v.push_back('X');
if (sol[0] != 'Y') v.push_back('Y');
for (int i = 2; i < N; i ++) {
string tren = "";
for (int j = 0; j < v.size(); j ++) {
tren += sol + v[0] + v[j];
}
tren += sol + v[1];
int t = press(tren);
if (t >= i+1) {
sol += v[0];
}
else if (t == i) {
sol += v[1];
}
else {
sol += v[2];
}
}
for (int i = 0; i < (int)v.size()-1; i ++) {
if (press(sol + v[i]) == N) {
return sol + v[i];
}
}
return sol + v[ (int)v.size()-1 ];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |