-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathvaibhaw
More file actions
90 lines (88 loc) · 2.42 KB
/
vaibhaw
File metadata and controls
90 lines (88 loc) · 2.42 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
///*
// .........................
// \|||||||||||||||||||||||/
// -----------------------
// | |
// | ____ ____ |
// | (*) (*) |
// [| | |]
// [ | < | ]
// | ____ |
// \ -- /
// \ /
// --------
// | | ||||
// ******************** < ||||
// **** ****************** **** \ /
// **** ****************** **** ****
// **** ****************** **** ****
// **** ****************** **** ****
// **** ****************** **** ****
// **** ****************** ********
// **** ****************** ****
// **** ****************** *
// **** ******************
// **** ******************
// **** ******************
// **** ******************
// **** ******************
// **** ------[[[]]]------
// **** ||||||||||||||||||
// **** ||||||||||||||||||
// (:::)||||||||/\|||||||||
// /|||\ ||||||/ \|||||||||
// ||||||||| |||||||||
// ||||||||| |||||||||
// ||||||||| |||||||||
// ||||||||| |||||||||
// ||||||||| |||||||||
// ||||||||| |||||||||
// ||||||||| |||||||||
// ||||||||| |||||||||
// | / \ |
// ( __ ) ( __ )
// ' ' ' '
// | | | |
// | \ / |
// | / \ |
// | / \ |
// | | | |
// | | | |
// / ] [ \
// / | | \
// """"" """""
//
//*/
#include<bits/stdc++.h>
using namespace std;
int n,l;
int f[100100];
double ta[100100],tb[100100];
int main()
{
int t;
cin>>t;
while(t--)
{
cin>>n>>l;
for(int i=1;i<=n;i++)
cin>>f[i];
for(int i=0;i<=n+1;i++)
ta[i]=tb[i]=0;
f[n+1]=l;
for(int i=1;i<=n+1;i++)
ta[i]=ta[i-1]+1.0*(f[i]-f[i-1])/i;
for(int i=n;i>=0;i--)
tb[i]=tb[i+1]+1.0*(f[i+1]-f[i])/(n-i+1);
int now=0;
while(ta[now]<=tb[now])
now++;
// cout<<now<<endl;
double timea=ta[now-1],timeb=tb[now];
// cout<<timea<<" "<<timeb<<endl;
double dist=f[now]-f[now-1];
dist+=(timeb-timea)*(n-now+2);
printf("%.8lf\n",timea+dist/(n+2));
}
return 0;
}