| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 76355 | arock | Combo (IOI18_combo) | C++14 | 2 ms | 200 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;
std::string guess_sequence(int N) {
char first = press("AB") == 0? "YA"[press("X")]:
"BA"[press("A")];
char a, b, c;
if(first == 'A') a = 'B', b = 'X', c = 'Y';
if(first == 'B') a = 'A', b = 'X', c = 'Y';
if(first == 'X') a = 'A', b = 'B', c = 'Y';
if(first == 'Y') a = 'A', b = 'B', c = 'X';
std::string S(1, first);
while(S.length() + 2 <= N) {
int coins = press(S + a + a + S + a + b + S + b + a) - S.length();
if (coins == 0) {
S += c;
} else if (coins == 1) {
coins = press(S + b + c) - S.length();
if (coins == 0) {
S += a, S += c;
} else if (coins == 1) {
S += b, S += b;
} else if (coins == 2) {
S += b, S += c;
}
} else if (coins == 2) {
coins = press(S + a + b) - S.length();
if (coins == 0) {
S += b, S += a;
} else if (coins == 1) {
S += a, S += a;
} else if (coins == 2) {
S += a, S += b;
}
}
}
if (S.length() < N) {
if (press(S + a) - S.length() == 1) {
S += a;
} else if(press(S + b) - S.length() == 1) {
S += b;
} else {
S += c;
}
}
return S;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
