Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define ld long double
- using namespace std;
- int main()
- {
- ll n, x;
- ld ans = (double)-1e18;
- cin >> n >> x;
- vector<ll> v(n);
- for (ll i = 0; i < n; ++i)
- cin >> v[i];
- sort(v.begin(), v.end());
- ld d = v[0];
- if (v[n - 1] <= x)
- if (x - v[n - 1] > d)
- d = x - v[n - 1];
- for (ll i = 1; i < n; ++i)
- {
- ld y = abs(v[i] - v[i - 1] + 0.0) / 2;
- ans = max(ans, y);
- }
- ans = max(ans, d);
- cout << fixed << setprecision(10) << ans << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment