# |
Author |
Problem |
Lang |
Verdict |
Time |
Memory |
Sent |
Judged |
|
209352828 |
Practice:
Alex_Wei |
1801F
- 50
|
C++17 (GCC 9-64)
|
Accepted
|
1450 ms
|
78588 KB
|
2023-06-12 11:19:37 |
2023-06-12 11:19:37 |
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
bool Mbe;
constexpr int N = 1e7 + 5;
int n, k;
vector<int> d;
double f[N];
void solve() {
cin >> n >> k;
if(k == 1) cout << "1\n", exit(0);
for(int l = 1; l <= k; ) {
int c = (k - 1) / l + 1;
d.push_back(c);
if(c > 1) l = (k - 1) / (c - 1) + 1;
else l = k + 1;
}
f[k] = 1;
for(int i = 1, a; i <= n; i++) {
cin >> a;
for(int j = d.size() - 2; ~j; j--) {
for(int l = 2; l <= d[j]; ) {
int c = (d[j] - 1) / l + 1;
f[c] = max(f[c], f[d[j]] * (a / l) / a);
if(c > 1) l = (d[j] - 1) / (c - 1) + 1;
else l = d[j] + 1;
}
}
}
printf("%.12lf\n", f[1] * k);
}
bool Med;
int main() {
fprintf(stderr, "%.3lf MB\n", (&Mbe - &Med) / 1048576.0);
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int T = 1;
while(T--) solve();
cerr << 1e3 * clock() / CLOCKS_PER_SEC << " ms\n";
return 0;
}
Click to see test details