# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1015442 | TroySer | 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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
string LETTERS = "ABXY";
char firsty;
if (press("AB") >= 1) {
if (press("A") == 1) firsty = 'A';
else firsty = 'B';
} else {
if (press("X") == 1) firsty = 'X';
else firsty = 'Y';
}
string currString = "";
currString += firsty;
if (N == 1) {
return currString;
}
char ind[3];
int indy = 0;
for (int i = 0; i < LETTERS.size(); i++) {
if (LETTERS[i] != firsty) {
ind[indy] = LETTERS[i];
indy++;
}
}
for (int i = 1; i < N-1; i++) {
// cout << currString + ind[0] + currString + ind[1] + ind[0] + currString + ind[1] + ind[1] + currString + ind[1] + ind[2] << "\n";
int res = press(currString + ind[0] + currString + ind[1] + ind[0] + currString + ind[1] + ind[1] + currString + ind[1] + ind[2]);
if (res == currString.size()) {
currString += ind[2];
} else if (res == currString.size() + 1) {
currString += ind[0];
} else {
currString += ind[1];
}
}
if (press(currString + "A" + currString + "B") == 1) {
if (press(currString + "A") == 1) currString += "A";
else currString += "B";
} else {
if (press(currString + "X") == 1) currString += "X";
else currString += "Y";
}
return currString;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |