# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112298 | socho | Combo (IOI18_combo) | C++14 | 2 ms | 244 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 <bits/stdc++.h>
using namespace std;
#include "combo.h"
string guess_sequence(int N) {
// return!
string anchor;
int ab = press("AB");
int oa = -1;
int ox = -1;
string rem;
if (ab > 0) {
// must be A or B anchor
oa = press("A");
if (oa > 0) {
anchor = "A";
rem = "BXY";
}
else {
anchor = "B";
rem = "AXY";
}
}
else {
// must be X or Y anchor
ox = press("X");
if (ox > 0) {
anchor = "X";
rem = "ABY";
}
else {
anchor = "Y";
rem = "ABX";
}
}
// cout << anchor;
string pref = anchor;
for (int i=1; i<N-1; i++) {
string query = pref + rem[0]
+ pref + rem[1] + rem[2]
+ pref + rem[1] + rem[0]
+ pref + rem[1] + rem[1];
//cout << "pres: " << query << endl;
int response = press(query);
//cout << " > got: " << response << endl;
if (response == pref.length()) {
pref += rem[2];
}
else if (response == pref.length() + 1) {
pref += rem[0];
}
else {
pref += rem[1];
}
}
//cout << "give: " << pref << endl;
string ender = pref + rem[0] + pref + rem[1];
int res = press(ender);
if (res == pref.size()) {
pref += rem[2];
}
else {
string ender2 = pref + rem[0];
int resp = press(ender2);
if (resp == pref.size()) {
pref += rem[1];
}
else {
pref += rem[0];
}
}
return pref;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |