-
Notifications
You must be signed in to change notification settings - Fork 0
/
492B.cpp
57 lines (56 loc) · 1.29 KB
/
492B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <bits/stdc++.h>
#define mod 1000000007
#define FOR(i, a, b) for (i = a; i < b; i++)
#define FastIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
int dxrow[] = {-1, 0, 0, 1, 1, 1, -1, -1}; //first 4 straight last 4 diagonals
int dycol[] = {0, -1, 1, 0, 1, -1, -1, 1};
void printV(vector<ll> v)
{
for (ll i = 0; i < v.size(); i++)
cout << v[i] << "\n";
}
ll power(ll a, ll b)
{
return (ll)(pow(a, b) + 0.5);
}
int modexp(ll A, ll B, ll C)
{
if (A == 0)
return 0;
if (B == 0)
return 1;
ll y;
if (B % 2 == 0)
{
y = modexp(A, B / 2, C);
y = (y * y) % C;
}
else
{
y = A % C;
y = (y * modexp(A, B - 1, C) % C) % C;
}
return (ll)((y + C) % C);
}
int main()
{
ll n, l;
cin >> n >> l;
ll a[n];
for (ll i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
double ans = DBL_MIN;
for (ll i = 1; i < n; i++)
ans = max(ans, double((a[i] - a[i - 1]) / 2.0));
ans = max({ans, double(a[0]), double(l - a[n - 1])});
cout << ans;
}