# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113496 | Mamnoon_Siam | Combo (IOI18_combo) | C++17 | 55 ms | 548 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 ret;
set<char> r;
r.insert('A');
r.insert('B');
r.insert('X');
r.insert('Y');
if(press("AB")) {
if(press("A")) {
ret += "A", r.erase('A');
} else {
ret += "B", r.erase('B');
}
} else {
if(press("X")) {
ret += "X", r.erase('X');
} else {
ret += "Y", r.erase('Y');
}
}
if(N == 1) return ret;
vector<int> R(r.begin(), r.end());
for(int i = 2; i < N; i++) {
string tmp;
tmp += ret;
tmp += R[0];
for(char ch : R) {
tmp += ret;
tmp += R[1];
tmp += ch;
}
int rep = press(tmp);
if(rep == ret.size()) ret += R[2];
else if(rep == ret.size() + 1) ret += R[0];
else ret += R[1];
}
for(int k = 0; k < 2; k++) {
char ch = R[k];
string tmp = ret;
tmp += ch;
if(press(tmp) == N) {
ret += ch;
break;
}
}
if(ret.size() != N) {
ret += R[2];
}
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |