# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1034758 | DeathIsAwe | Combo (IOI18_combo) | C++14 | 20 ms | 1884 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) {
vector<char> letters;
string p = "";
string ptemp = "";
int temp = press("AB");
if (temp == 2) {
p += 'A';
} else if (temp == 1) {
temp = press("A");
if (temp == 1) {
p += 'A';
} else {
p += 'B';
}
} else {
temp = press("X");
if (temp == 1) {
p += 'X';
} else {
p += 'Y';
}
}
if ('A' != p[0]) {
letters.push_back('A');
}
if ('B' != p[0]) {
letters.push_back('B');
}
if ('X' != p[0]) {
letters.push_back('X');
}
if ('Y' != p[0]) {
letters.push_back('Y');
}
if (n == 1) {
return p;
}
while (p.size() < n-1) {
ptemp = "";
for (int i=0;i<3;i++) {
ptemp += p;
ptemp += letters[0];
ptemp += letters[i];
}
ptemp += p;
ptemp += letters[1];
temp=press(ptemp);
if (temp == p.size()) {
p += letters[2];
} else if (temp == p.size()+1) {
p += letters[1];
} else {
p += letters[0];
}
}
ptemp = p + letters[0];
if (press(ptemp) == n) {
p += letters[0];
return p;
} else {
ptemp = p + letters[1];
if (press(ptemp) == n) {
p += letters[1];
return p;
} else {
p += letters[2];
return p;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |