# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
314116 | Lemur95 | Combo (IOI18_combo) | C++17 | 59 ms | 512 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>
#pragma GCC optimize("Ofast")
#define x first
#define y second
#define ld long double
#define ll long long
using namespace std;
int n;
string s;
int press(string p);
/*int press(string p) {
int ans = 0;
for(int i = 0; i < p.size(); i++) {
for(int j = i; j < i + s.size() && j < p.size(); j++) {
if(p[j] == s[j - i])
ans = max(ans, j - i + 1);
else
break;
}
}
return ans;
}*/
string guess_sequence(int n) {
string s, t;
if(press("AB")) {
if(press("A")) {
s += 'A';
t = "BXY";
} else {
s += 'B';
t = "AXY";
}
} else {
if(press("X")) {
s += 'X';
t = "ABY";
} else {
s += 'Y';
t = "ABX";
}
}
if(n == 1)
return s;
for(int i = 1; i < n - 1; i++) {
int ans = press(s + t[0] + s + t[1] + t[0] + s + t[1] + t[1] + s + t[1] + t[2]) - s.size();
if(ans == 0)
s += t[2];
else if(ans == 1)
s += t[0];
else
s += t[1];
}
if(press(s + t[0] + s + t[1]) > s.size()) {
if(press(s + t[0]) > s.size())
s += t[0];
else
s += t[1];
} else
s += t[2];
return s;
}
/*int main() {
ios_base :: sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> s;
string ans = guess_sequence(n);
if(ans == s)
cout << "Accepted!";
else
cout << "Wrong answer, output = " << ans;
return 0;
}*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |