1. #include <bits/stdc++.h>
2. using namespace std;
3. #define infinity (1000000007)
4. #define ll long long
5. #define ull unsigned long long
6. #define pii pair<int,int>
7. #define ppi pair<pii,int>
8. #define ppp pair<pii,pii>
9. #define pip pair<int,pii>
10. #define pb push_back
11. #define mp make_pair
12. #define eps 1e-9
13. #define s(n) scanf("%d",&n)
14. #define s2(n,m) scanf("%d%d",&n,&m)
15. #define s3(n,m,l) scanf("%d%d%d",&n,&m,&l)
16. #define s4(n,m,l,x) scanf("%d%d%d%d",&n,&m,&l,&x)
17. #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
18. ll pwr(ll a,ll b,ll mod) {a%=mod;if(a<0)a+=mod;ll ans=1; while(b) {if(b&1) ans=(ans*a)%mod; a=(a*a)%mod; b/=2; } return ans; }
19. ll pwr(ll a,ll b) {ll ans=1; while(b) {if(b&1) ans*=a; a*=a; b/=2; } return ans; }
20. ll gcd(ll a,ll b) {while(b) {ll temp=a; a=b; b=temp%b; } return a; }
21. ll lcm(ll a,ll b) {return (a/gcd(a,b))*b; }
22. string toString(int j){string s = "";while(j){int temp=j%10;s+=temp+'0';j=j/10;}reverse(s.begin(),s.end());return s;}
23. ll modularInverse(ll a,ll m) {/*reminder: make sure m is prime*/ assert(false); return pwr(a,m-2,m); }
24. const int mod=1000000007;
25.
26. int n;
27. double k;
28. int a[2*100005];
29.
30. bool possible(double x){
31.
32. if(x<=a[1] && 2*x<=a[n+1])
33. return true;
34. return false;
35. }
36.
37. int main(){
38.
39. cin >> n >> k;
40.
41. for(int i=1;i<=2*n;i++)
42. cin >> a[i];
43.
44. sort(a+1,a+2*n+1);
45.
46. double lo = 0.0,hi=(double)k/(double)(n*3),mid=0.0,ans=0.0;
47.
48. while(fabs(hi-lo)>eps){
49. mid=(lo+hi)/2.0;
50.
51. if(possible(mid)){
52. ans = mid;
53. lo = mid;
54. }
55. else hi=mid;
56. }
57.
58. ans = 3*n*ans;
59. printf("%.6lf",ans);
60.
61.
62.
63.
64.
65.
66.
67.
68. return 0;
69. }
Success #stdin #stdout 0s 4244KB
stdin
Standard input is empty
stdout
0.000000