# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
700571 |
2023-02-19T07:31:01 Z |
m_fenais |
Seesaw (JOI22_seesaw) |
C++17 |
|
1 ms |
260 KB |
#include <bits/stdc++.h>
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
using namespace std;
const int N = 200 + 10, mod = 1e9 + 7;
int n;
double a[N], pref[N];
double solve(int l, int r, double cur, double mi, double mx) {
if(l == r) {
mi = min(cur, mi);
mx = max(cur, mx);
return abs(mx - mi);
}
double c1 = 0, c2 = 0;
if(l < n) c1 = solve(l + 1, r, double(double(pref[r] - pref[l])/double(r-l)), min(mi, cur), max(mx, cur));
if(r > 1) c2 = solve(l, r - 1, double(double(pref[r-1] - pref[l-1])/double(r-l)), min(mi, cur), max(mx, cur));
return min(c1, c2);
}
signed main()
{
FAST;
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
pref[1] = a[1];
for(int i = 2; i <= n; i++) pref[i] += a[i] + pref[i-1];
cout << solve(1, n, double(pref[n]/n), double(pref[n]/n), double(pref[n]/n)) << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |