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;
using ll = long long;
template<class T> bool cmin(T &i, T j) { return i > j ? i=j,true:false; }
template<class T> bool cmax(T &i, T j) { return i < j ? i=j,true:false; }
/*
string W = "ABXYY";
int sz = 5;
int press(string p) {
for (int i=1;i<=sz;i++) {
if (p.find(W.substr(0,i)) == string::npos) {
return i-1;
}
}
return sz;
}
*/
int press(string p);
string guess_sequence(int n) {
string res = "";
vector<string> v = {"A","B","X","Y"};
string F;
for (auto &x: v) {
if (press(x) == 1) {
F = x;
break;
}
}
res += F;
for (int i=2;i<=n;i++) {
for (auto &x: v) {
if (x != F && press(res+x) == i) {
res += x;
break;
}
}
}
return res;
}
/*
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout << guess_sequence(sz) << endl;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |