| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 295798 | MilosMilutinovic | 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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
/*string combination;
int press(string s) {
int n = (int) combination.length(), m = (int) s.length(), ans = 0;
for (int i = 0; i < m; i++) {
int cnt = 0;
for (int j = 0; j < n; j++) {
if (i + j >= m || s[i + j] != combination[j]) {
break;
}
cnt++;
}
ans = max(ans, cnt);
}
return ans;
}*/
string guess_sequence(int N) {
string ans = "";
if (press("A") == 1) {
ans = "A";
} else {
if (press("B") == 1) {
ans = "B";
} else {
if (press("X") == 1) {
ans = "X";
} else {
ans = "Y";
}
}
}
for (int i = 1; i < N - 1; i++) {
int k = ans.length();
if (ans[0] == 'A') {
int x = press(ans + "B" + ans + "XB" + ans + "XX" + ans + "XY");
//cout << x << endl;
if (x == k) {
ans += 'Y';
} else {
if (x == k + 1) {
ans += 'B';
} else {
ans += 'X';
}
}
} else {
if (ans[0] == 'B') {
int x = press(ans + "A" + ans + "XA" + ans + "XX" + ans + "XY");
//cout << x << endl;
if (x == k) {
ans += 'Y';
} else {
if (x == k + 1) {
ans += 'A';
} else {
ans += 'X';
}
}
} else {
if (ans[0] == 'X') {
int x = press(ans + "A" + ans + "BA" + ans + "BB" + ans + "BY");
//cout << x << endl;
if (x == k) {
ans += 'Y';
} else {
if (x == k + 1) {
ans += 'A';
} else {
ans += 'B';
}
}
} else {
int x = press(ans + "A" + ans + "BA" + ans + "BB" + ans + "BX");
//cout << x << endl;
if (x == k) {
ans += 'X';
} else {
if (x == k + 1) {
ans += 'A';
} else {
ans += 'B';
}
}
}
}
}
}
int k = ans.length();
if (ans[0] == 'A') {
if (press(ans + 'B') == k + 1) {
ans += 'B';
} else {
if (press(ans + 'X') == k + 1) {
ans +=' X';
} else {
ans += 'Y';
}
}
} else {
if (ans[0] == 'B') {
if (press(ans + 'A') == k + 1) {
ans += 'A';
} else {
if (press(ans + 'X') == k + 1) {
ans += 'X';
} else {
ans += 'Y';
}
}
} else {
if (ans[0] == 'X') {
if (press(ans + 'A') == k + 1) {
ans += 'A';
} else {
if (press(ans + 'B') == k + 1) {
ans += 'B';
} else {
ans += 'Y';
}
}
} else {
if (press(ans + 'A') == k + 1) {
ans += 'A';
} else {
if (press(ans + 'B') == k + 1) {
ans += 'B';
} else {
ans += 'X';
}
}
}
}
}
return ans;
}
/*int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> combination;
cout << guess_sequence(combination.length()) << '\n';
return 0;
}*/
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
