QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#298263#6302. Mapnameless_storyAC ✓1ms4032kbC++2013.7kb2024-01-05 21:51:262024-01-05 21:51:27

Judging History

你现在查看的是最新测评结果

  • [2024-01-05 21:51:27]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:4032kb
  • [2024-01-05 21:51:26]
  • 提交

answer

//这回只花了114514min就打完了。
//真好。记得多手造几组。ACM拍什么拍。 
#include "bits/stdc++.h"
using namespace std;
template<typename T1,typename T2> istream &operator>>(istream &cin,pair<T1,T2> &a) { return cin>>a.first>>a.second; }
template<typename T1> istream &operator>>(istream &cin,vector<T1> &a) { for (auto &x:a) cin>>x; return cin; }
template<typename T1> istream &operator>>(istream &cin,valarray<T1> &a) { for (auto &x:a) cin>>x; return cin; }
template<typename T1,typename T2> ostream &operator<<(ostream &cout,const pair<T1,T2> &a) { return cout<<a.first<<' '<<a.second; }
template<typename T1,typename T2> ostream &operator<<(ostream &cout,const vector<pair<T1,T2>> &a) { for (auto &x:a) cout<<x<<'\n'; return cout; }
template<typename T1> ostream &operator<<(ostream &cout,const vector<T1> &a) { int n=a.size(); if (!n) return cout; cout<<a[0]; for (int i=1; i<n; i++) cout<<' '<<a[i]; return cout; }
template<typename T1,typename T2> bool cmin(T1 &x,const T2 &y) { if (y<x) { x=y; return 1; } return 0; }
template<typename T1,typename T2> bool cmax(T1 &x,const T2 &y) { if (x<y) { x=y; return 1; } return 0; }
template<typename T1> vector<T1> range(T1 l,T1 r,T1 step=1) { assert(step>0); int n=(r-l+step-1)/step,i; vector<T1> res(n); for (i=0; i<n; i++) res[i]=l+step*i; return res; }
template<typename T1> basic_string<T1> operator*(const basic_string<T1> &s,int m) { auto r=s; m*=s.size(); r.resize(m); for (int i=s.size(); i<m; i++) r[i]=r[i-s.size()]; return r; }
#if !defined(ONLINE_JUDGE)&&defined(LOCAL)
#include "my_header\debug.h"
#else
#define dbg(...) ;
#define dbgn(...) ;
#endif
typedef unsigned int ui;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
// template<typename T1,typename T2> void inc(T1 &x,const T2 &y) { if ((x+=y)>=p) x-=p; }
// template<typename T1,typename T2> void dec(T1 &x,const T2 &y) { if ((x+=p-y)>=p) x-=p; }
const int N=1e6+5;

namespace geometry//不要用 int!
{
#define tmpl template<typename T>
	typedef long long ll;
	typedef long double db;
	const db eps=1e-6;
#define all(x) (x).begin(),(x).end()
	inline int sgn(const ll &x)
	{
		if (x<0) return -1;
		return x>0;
	}
	inline int sgn(const db &x)
	{
		if (fabs(x)<eps) return 0;
		return x>0?1:-1;
	}
	tmpl struct point//* 为叉乘,& 为点乘,只允许使用 double 和 ll
	{
		T x,y;
		point() { }
		point(T a,T b):x(a),y(b) { }
		operator point<ll>() const { return point<ll>(x,y); }
		operator point<db>() const { return point<db>(x,y); }
		point<T> operator+(const point<T> &o) const { return point(x+o.x,y+o.y); }
		point<T> operator-(const point<T> &o) const { return point(x-o.x,y-o.y); }
		point<T> operator*(const T &k) const { return point(x*k,y*k); }
		point<T> operator/(const T &k) const { return point(x/k,y/k); }
		T operator*(const point<T> &o) const { return x*o.y-y*o.x; }
		T operator&(const point<T> &o) const { return x*o.x+y*o.y; }
		void operator+=(const point<T> &o) { x+=o.x; y+=o.y; }
		void operator-=(const point<T> &o) { x-=o.x; y-=o.y; }
		void operator*=(const T &k) { x*=k; y*=k; }
		void operator/=(const T &k) { x/=k; y/=k; }
		bool operator==(const point<T> &o) const { return x==o.x&&y==o.y; }
		bool operator!=(const point<T> &o) const { return x!=o.x||y!=o.y; }
		db len() const { return sqrt(len2()); }//模长
		T len2() const { return x*x+y*y; }
	};
	const point<db> npos=point<db>(514e194,9810e191),apos=point<db>(145e174,999e180);
	const int DS[4]={1,2,4,3};
	tmpl int quad(const point<T> &o)//坐标轴归右上象限,返回值 [1,4]
	{
		return DS[(sgn(o.y)<0)*2+(sgn(o.x)<0)];
	}
	tmpl bool angle_cmp(const point<T> &a,const point<T> &b)
	{
		int c=quad(a),d=quad(b);
		if (c!=d) return c<d;
		return a*b>0;
	}
	tmpl db dis(const point<T> &a,const point<T> &b) { return (a-b).len(); }
	tmpl T dis2(const point<T> &a,const point<T> &b) { return (a-b).len2(); }
	tmpl point<T> operator*(const T &k,const point<T> &o) { return point<T>(k*o.x,k*o.y); }
	tmpl bool operator<(const point<T> &a,const point<T> &b)
	{
		int s=sgn(a*b);
		return s>0||s==0&&sgn(a.len2()-b.len2())<0;
	}
	istream &operator>>(istream &cin,point<ll> &o) { return cin>>o.x>>o.y; }
	istream &operator>>(istream &cin,point<db> &o)
	{
		string s;
		cin>>s;
		o.x=stod(s);
		cin>>s;
		o.y=stod(s);
		return cin;
	}
	tmpl ostream &operator<<(ostream &cout,const point<T> &o)
	{
		if ((point<db>)o==apos) return cout<<"all position";
		if ((point<db>)o==npos) return cout<<"no position";
		return cout<<'('<<o.x<<','<<o.y<<')';
	}
	tmpl struct line
	{
		point<T> o,d;
		line() { }
		line(const point<T> &a,const point<T> &b,int twopoint);
		bool operator!=(const line<T> &m) { return !(*this==m); }
	};
	template<> line<ll>::line(const point<ll> &a,const point<ll> &b,int twopoint)
	{
		o=a;
		d=twopoint?b-a:b;
		ll tmp=gcd(d.x,d.y);
		assert(tmp);
		if (d.x<0||d.x==0&&d.y<0) tmp=-tmp;
		d.x/=tmp; d.y/=tmp;
	}
	template<> line<db>::line(const point<db> &a,const point<db> &b,int twopoint)
	{
		o=a;
		d=twopoint?b-a:b;
		int s=sgn(d.x);
		if (s<0||!s&&d.y<0) d.x=-d.x,d.y=-d.y;
	}
	tmpl line<T> rotate_90(const line<T> &m) { return line(m.o,point(m.d.y,-m.d.x),0); }
	tmpl line<db> rotate(const line<T> &m,db angle)
	{
		return {(point<db>)m.o,{m.d.x*cos(angle)-m.d.y*sin(angle),m.d.x*sin(angle)+m.d.y*cos(angle)},0};
	}
	tmpl db get_angle(const line<T> &m,const line<T> &n) { return asin((m.d*n.d)/(m.d.len()*n.d.len())); }
	tmpl bool operator<(const line<T> &m,const line<T> &n)
	{
		int s=sgn(m.d*n.d);
		return s?s>0:m.d*m.o<n.d*n.o;
	}
	bool operator==(const line<ll> &m,const line<ll> &n) { return m.d==n.d&&(m.o-n.o)*m.d==0; }
	bool operator==(const line<db> &m,const line<db> &n) { return fabs(m.d*n.d)<eps&&fabs((n.o-m.o)*m.d)<eps; }
	tmpl ostream &operator<<(ostream &cout,const line<T> &o) { return cout<<'('<<o.d.x<<" k + "<<o.o.x<<" , "<<o.d.y<<" k + "<<o.o.y<<")"; }
	tmpl point<db> intersect(const line<T> &m,const line<T> &n)
	{
		if (!sgn(m.d*n.d))
		{
			if (!sgn(m.d*(n.o-m.o))) return apos;
			return npos;
		}
		return (point<db>)m.o+(n.o-m.o)*n.d/(db)(m.d*n.d)*(point<db>)m.d;
	}
	tmpl db dis(const line<T> &m,const point<T> &o) { return abs(m.d*(o-m.o)/m.d.len()); }
	tmpl db dis(const point<T> &o,const line<T> &m) { return abs(m.d*(o-m.o)/m.d.len()); }
	struct circle
	{
		point<db> o;
		db r;
		circle() { }
		circle(const point<db> &O,const db &R=0):o(point<db>((db)O.x,(db)O.y)),r(R) { }//圆心半径构造
		circle(const point<db> &a,const point<db> &b)//直径构造
		{
			o=(a+b)*0.5;
			r=dis(b,o);
		}
		circle(const point<db> &a,const point<db> &b,const point<db> &c)//三点构造外接圆(非最小圆)
		{
			auto A=(b+c)*0.5,B=(a+c)*0.5;
			o=intersect(rotate_90(line(A,c,1)),rotate_90(line(B,c,1)));
			r=dis(o,c);
		}
		circle(vector<point<db>> a)
		{
			int n=a.size(),i,j,k;
			mt19937 rnd(75643);
			shuffle(all(a),rnd);
			*this=circle(a[0]);
			for (i=1; i<n; i++) if (!cover(a[i]))
			{
				*this=circle(a[i]);
				for (j=0; j<i; j++) if (!cover(a[j]))
				{
					*this=circle(a[i],a[j]);
					for (k=0; k<j; k++) if (!cover(a[k])) *this=circle(a[i],a[j],a[k]);
				}
			}
		}
		circle(const vector<point<ll>> &b)
		{
			vector<point<db>> a(b.size());
			int n=a.size(),i,j,k;
			for (i=0; i<a.size(); i++) a[i]=(point<db>)b[i];
			*this=circle(a);
		}
		tmpl bool cover(const point<T> &a) { return sgn(dis((point<db>)a,o)-r)<=0; }
	};
	tmpl struct segment
	{
		point<T> a,b;
		segment() { }
		segment(point<T> o,point<T> p)
		{
			int s=sgn(o.x-p.x);
			if (s>0||!s&&o.y>p.y) swap(o,p);
			a=o; b=p;
		}
	};
	tmpl bool intersect(const segment<T> &m,const segment<T> &n)
	{
		auto a=n.b-n.a,b=m.b-m.a;
		auto d=n.a-m.a;
		if (sgn(n.b.x-m.a.x)<0||sgn(m.b.x-n.a.x)<0) return 0;
		if (sgn(max(n.a.y,n.b.y)-min(m.a.y,m.b.y))<0||sgn(max(m.a.y,m.b.y)-min(n.a.y,n.b.y))<0) return 0;
		return sgn(b*d)*sgn((n.b-m.a)*b)>=0&&sgn(a*d)*sgn((m.b-n.a)*a)<=0;
	}
	tmpl struct convex
	{
		vector<point<T>> p;
		convex(vector<point<T>> a);
		db peri()//周长
		{
			int i,n=p.size();
			db C=(p[n-1]-p[0]).len();
			for (i=1; i<n; i++) C+=(p[i-1]-p[i]).len();
			return C;
		}
		db area() { return area2()*0.5; }//面积
		T area2()//两倍面积
		{
			int i,n=p.size();
			T S=p[n-1]*p[0];
			for (i=1; i<n; i++) S+=p[i-1]*p[i];
			return abs(S);
		}
		db diam() { return sqrt(diam2()); }
		T diam2()//直径平方
		{
			T r=0;
			int n=p.size(),i,j;
			if (n<=2)
			{
				for (i=0; i<n; i++) for (j=i+1; j<n; j++) r=max(r,dis2(p[i],p[j]));
				return r;
			}
			p.push_back(p[0]);
			for (i=0,j=1; i<n; i++)
			{
				while ((p[i+1]-p[i])*(p[j]-p[i])<=(p[i+1]-p[i])*(p[j+1]-p[i])) if (++j==n) j=0;
				r=max({r,dis2(p[i],p[j]),dis2(p[i+1],p[j])});
			}
			p.pop_back();
			return r;
		}
		bool cover(const point<T> &o) const//点是否在凸包内
		{
			if (o.x<p[0].x||o.x==p[0].x&&o.y<p[0].y) return 0;
			if (o==p[0]) return 1;
			if (p.size()==1) return 0;
			ll tmp=(o-p[0])*(p.back()-p[0]);
			if (tmp==0) return dis2(o,p[0])<=dis2(p.back(),p[0]);
			if (tmp<0||p.size()==2) return 0;
			int x=upper_bound(1+all(p),o,[&](const point<T> &a,const point<T> &b) { return (a-p[0])*(b-p[0])>0; })-p.begin()-1;
			return (o-p[x])*(p[x+1]-p[x])<=0;
		}
		convex<T> operator+(const convex<T> &A) const
		{
			int n=p.size(),m=A.p.size(),i,j;
			vector<point<T>> c;
			if (min(n,m)<=2)
			{
				c.reserve(n*m);
				for (i=0; i<n; i++) for (j=0; j<m; j++) c.push_back(p[i]+A.p[j]);
				return convex<T>(c);
			}
			point<T> a[n],b[m];
			for (i=0; i+1<n; i++) a[i]=p[i+1]-p[i];
			a[n-1]=p[0]-p[n-1];
			for (i=0; i+1<m; i++) b[i]=A.p[i+1]-A.p[i];
			b[m-1]=A.p[0]-A.p[m-1];
			c.reserve(n+m);
			c.push_back(p[0]+A.p[0]);
			for (i=j=0; i<n&&j<m;) c.push_back(c.back()+(a[i]*b[j]>0?a[i++]:b[j++]));
			while (i<n-1) c.push_back(c.back()+a[i++]);
			while (j<m-1) c.push_back(c.back()+b[j++]);
			return convex<T>(c);
		}
		void operator+=(const convex &a) { *this=*this+a; }
	};
	tmpl convex<T>::convex(vector<point<T>> a)
	{
		int n=a.size(),i;
		if (!n) return;
		p=a;
		for (i=1; i<n; i++) if (p[i].x<p[0].x||p[i].x==p[0].x&&p[i].y<p[0].y) swap(p[0],p[i]);
		a.resize(0); a.reserve(n);
		for (i=1; i<n; i++) if (p[i]!=p[0]) a.push_back(p[i]-p[0]);
		sort(all(a));
		for (i=0; i<a.size(); i++) a[i]+=p[0];
		point<T> *st=p.data()-1;
		int tp=1;
		for (auto &v:a)
		{
			while (tp>1&&sgn((st[tp]-st[tp-1])*(v-st[tp-1]))<=0) --tp;
			st[++tp]=v;
		}
		p.resize(tp);
	}
	template<> bool convex<db>::cover(const point<db> &o) const//点是否在凸包内
	{
		if (o.x<p[0].x||o.x==p[0].x&&o.y<p[0].y) return 0;
		if (o==p[0]) return 1;
		if (p.size()==1) return 0;
		ll tmp=(o-p[0])*(p.back()-p[0]);
		if (tmp==0) return dis2(o,p[0])<=dis2(p.back(),p[0]);
		if (tmp<0||p.size()==2) return 0;
		int x=upper_bound(1+all(p),o,[&](const point<db> &a,const point<db> &b) { return (a-p[0])*(b-p[0])>eps; })-p.begin()-1;
		return (o-p[x])*(p[x+1]-p[x])<=0;
	}
	tmpl struct half_plane//默认左侧
	{
		point<T> o,d;
		operator half_plane<ll>() const { return {(point<ll>)o,(point<ll>)d,0}; }
		operator half_plane<db>() const { return {(point<db>)o,(point<db>)d,0}; }
		half_plane() { }
		half_plane(const point<T> &a,const point<T> &b,bool twopoint)
		{
			o=a;
			d=twopoint?b-a:b;
		}
		bool operator<(const half_plane<T> &a) const
		{
			int p=quad(d),q=quad(a.d);
			if (p!=q) return p<q;
			p=sgn(d*a.d);
			if (p) return p>0;
			return sgn(d*(a.o-o))>0;
		}
	};
	tmpl ostream &operator<<(ostream &cout,half_plane<T> &m) { return cout<<m.o<<" | "<<m.d; }
	tmpl point<db> intersect(const half_plane<T> &m,const half_plane<T> &n)
	{
		if (!sgn(m.d*n.d))
		{
			if (!sgn(m.d*(n.o-m.o))) return apos;
			return npos;
		}
		return (point<db>)m.o+(n.o-m.o)*n.d/(db)(m.d*n.d)*(point<db>)m.d;
	}
	const db inf=1e9;
	tmpl convex<db> intersect(vector<half_plane<T>> a)
	{
		T I=inf;
		a.push_back({{-I,-I},{I,-I},1});
		a.push_back({{I,-I},{I,I},1});
		a.push_back({{I,I},{-I,I},1});
		a.push_back({{-I,I},{-I,-I},1});
		sort(all(a));
		int n=a.size(),i,h=0,t=-1;
		half_plane<db> q[n];
		point<db> p[n];
		vector<point<db>> r;
		for (i=0; i<n; i++) if (i==n-1||sgn(a[i].d*a[i+1].d))
		{
			auto x=(half_plane<db>)a[i];
			while (h<t&&sgn((p[t-1]-x.o)*x.d)>=0) --t;
			while (h<t&&sgn((p[h]-x.o)*x.d)>=0) ++h;
			q[++t]=x;
			if (h<t) p[t-1]=intersect(q[t-1],q[t]);
		}
		while (h<t&&sgn((p[t-1]-q[h].o)*q[h].d)>=0) --t;
		if (h==t) return convex<db>(vector<point<db>>(0));
		p[t]=intersect(q[h],q[t]);
		return convex<db>(vector<point<db>>(p+h,p+t+1));
	}
	tmpl db dis(const point<db> &o,const segment<T> &l)
	{
		if ((l.b-l.a&o-l.a)<0||(l.a-l.b&o-l.b)<0) return min(dis(o,l.a),dis(o,l.b));
		return dis(o,line(l.a,l.b,1));
	}
	tmpl db dis(const segment<T> &l,const point<db> &o)
	{
		if ((l.b-l.a&o-l.a)<0||(l.a-l.b&o-l.b)<0) return min(dis(o,l.a),dis(o,l.b));
		return dis(o,line(l.a,l.b,1));
	}
#undef tmpl
}
using geometry::point,geometry::line,geometry::circle,geometry::convex,geometry::half_plane;
using geometry::db,geometry::sgn,geometry::eps,geometry::segment;
using geometry::intersect,geometry::dis;
using Q=point<db>;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cout<<fixed<<setprecision(15);
	int T; cin>>T;
	while (T--)
	{
		int n,m,i,j;
		db k;
		vector<Q> a(4),b(4);
		Q s,t;
		cin>>a>>b>>s>>t>>k>>n;
		vector<Q> S(n+1),T(n+1);
		S[0]=s; T[0]=t;
		for (int i:{1,3})
		{
			a[i]-=a[0]; a[i]/=a[i].len2();
			b[i]-=b[0];
		}
		db ans=1e18;
		auto tran=[&](Q s)
			{
				s-=a[0];
				return b[0]+(s&a[1])*b[1]+(s&a[3])*b[3];
			};
		for (i=1; i<=n; i++) S[i]=tran(S[i-1]),T[i]=tran(T[i-1]);
		for (i=0; i<=n; i++) for (j=0; j<=i; j++) cmin(ans,dis(S[j],T[i-j])+i*k);
		cout<<ans<<'\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3808kb

input:

2
0 0 0 2 4 2 4 0
0 0 0 1 2 1 2 0
2 1 4 2
1 1
0 0 0 3 6 3 6 0
0 1 1 0 3 2 2 3
0 0 4 2
0 3

output:

1.000000000000000
1.227262335243029

result:

ok 2 numbers

Test #2:

score: 0
Accepted
time: 1ms
memory: 3708kb

input:

100
-133 -128 -109 -134 -85 -38 -109 -32
-95 -37 -100 -35 -108 -55 -103 -57
-119 -130 -112 -44
2 73
5 -100 5 -8 1 -8 1 -100
1 -60 1 -14 3 -14 3 -60
3 -84 1 -20
2 53
-58 -78 -66 -78 -66 -34 -58 -34
-58 -34 -66 -34 -66 -78 -58 -78
-63 -50 -63 -37
4 54
52 -148 116 -148 116 -52 52 -52
53 -103 53 -71 101...

output:

9.500657499741558
12.229731078922158
13.000000000000000
17.488532900375079
13.341664064126334
7.615773105863908
23.409399821439250
7.280109889280518
21.280037734083885
59.776022092579124
4.123105625617661
79.649231006959508
65.069193939989759
14.142135623730950
41.824615503479754
16.056245184896988
...

result:

ok 100 numbers

Test #3:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

100
-173 -113 -120 -113 -120 -115 -173 -115
-173 -115 -120 -115 -120 -113 -173 -113
-162 -114 -152 -114
99 57
6 23 -75 4 -56 -77 25 -58
0 -58 -51 -69 -62 -18 -11 -7
-22 -56 -42 -25
19 27
-98 -115 -150 -147 -158 -134 -106 -102
-150 -147 -98 -115 -106 -102 -158 -134
-103 -111 -136 -134
25 50
136 -92 1...

output:

10.000000000000000
25.483637975584368
40.224370722237533
18.384776310850236
9.219544457292887
18.027756377319946
43.114063026280356
52.887044352349006
45.541190146942800
55.000999975001250
37.000000000000000
12.041594578792295
24.331050121192879
18.110770276274833
7.563262753279504
2.236067977499790...

result:

ok 100 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

100
-12 -206 72 -188 135 -482 51 -500
19 -301 23 -301 23 -315 19 -315
88 -368 28 -248
14 87
-221 -566 -467 -566 -467 -565 -221 -565
-221 -566 -467 -566 -467 -565 -221 -565
-297 -566 -289 -566
274 18
-264 759 -339 609 -129 504 -54 654
-208 580 -208 655 -103 655 -103 580
-196 664 -211 596
8 64
-111 -3...

output:

34.246950475544243
8.000000000000000
45.926952286842947
135.118466539551876
131.973482184869245
40.349665953953499
15.321347728712508
77.772275035020517
66.738813035899371
8.000266654815868
116.806446031673097
12.588290015615974
170.785630266285701
131.962750429094417
8.738089975160307
17.4642491965...

result:

ok 100 numbers

Test #5:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

100
-235 -704 133 -704 133 -720 -235 -720
-224 -712 -40 -712 -40 -704 -224 -704
15 -711 76 -718
4 74
-467 574 -475 596 -123 724 -115 702
-274 662 -270 652 -430 588 -434 598
-458 588 -241 657
15 31
380 -3 532 -343 787 -229 635 111
503 -71 639 -163 708 -61 572 31
533 -189 613 -137
3 58
-460 -7 -488 -7...

output:

31.350081433008751
51.967632320937980
21.468697928146776
38.837932076467767
84.248187428308027
77.929455278476058
47.000000000000000
74.115493725912497
86.467104880421689
35.114099732158875
3.605551275463989
97.416631023660431
24.606056965764579
56.773359432723913
6.998534619414935
13.45362404707371...

result:

ok 100 numbers

Test #6:

score: 0
Accepted
time: 1ms
memory: 3840kb

input:

100
-1201 2822 -1197 2814 -3437 1694 -3441 1702
-3119 1860 -3117 1856 -1997 2416 -1999 2420
-1419 2709 -2491 2174
48 76
-2515 285 -2547 306 -1308 2194 -1276 2173
-2255 683 -2260 686 -2083 981 -2078 978
-1572 1753 -1392 2015
121 28
-1216 1209 -1498 -1141 -1598 -1129 -1316 1221
-1494 -823 -1494 -447 -...

output:

264.055863532879047
290.425700450936407
258.282400313066252
743.737184763542665
341.052781838823300
400.566683662432774
172.040799340956913
27.770894609837870
294.825880152081154
508.065910688872964
501.781825099315449
666.805068966935793
180.069431053691065
193.610433603150634
1507.002986062071478
...

result:

ok 100 numbers

Test #7:

score: 0
Accepted
time: 1ms
memory: 3912kb

input:

100
1411 -2755 603 -3563 623 -3583 1431 -2775
716 -3477 1120 -3073 1110 -3063 706 -3467
1210 -2959 1339 -2830
2319 39
4528 -3417 4286 -4055 1908 -3153 2150 -2515
2094 -2892 2094 -3090 2832 -3090 2832 -2892
2257 -2993 4389 -3736
17 22
-180 -1673 -2172 -3665 -2164 -3673 -172 -1681
-284 -1792 -2027 -35...

output:

182.433549546129261
96.880923053928568
530.330085889910643
44.011362169330774
64.313365366181941
7.392893666126124
34.567810207462374
148.850160742992533
350.338135916148604
329.225162779821198
68.864765108872990
32.824383174612819
244.695729427384981
685.968837711980812
141.362747995939058
1601.789...

result:

ok 100 numbers

Test #8:

score: 0
Accepted
time: 1ms
memory: 3956kb

input:

100
11928 -18111 8928 -17411 11056 -8291 14056 -8991
11043 -10811 10793 -10111 12921 -9351 13171 -10051
10491 -14092 11923 -12413
10 92
11869 -4371 3539 5429 1299 3525 9629 -6275
8302 -3064 3647 2571 4935 3635 9590 -2000
2384 2680 3466 2644
181 91
4001 -10187 4001 -10897 9 -10897 9 -10187
838 -10629...

output:

87.479657002630678
977.209322820567369
94.486325059360631
307.006514588860150
1245.629559700635878
532.000000000000000
369.048777263927539
19.554024317232545
1509.000000000000000
275.094267211329335
4242.193351514708150
465.656251408810373
3478.304242060182535
1754.356007200362967
1804.4669275859330...

result:

ok 100 numbers

Test #9:

score: 0
Accepted
time: 1ms
memory: 4032kb

input:

100
10303 -4099 19487 -8131 19703 -7639 10519 -3607
18394 -7495 18842 -7271 18854 -7295 18406 -7519
15852 -6248 15950 -6389
38 10
13132 -3411 17416 3393 15634 4515 11350 -2289
13143 -873 15411 3411 16533 2817 14265 -1467
16515 2577 16017 1561
198 94
-5480 10872 -6297 11294 -11361 1490 -10544 1068
-1...

output:

84.574886489291820
999.689277678129568
6231.529667746114486
550.947886095034877
182.544124658606006
5374.296791209060125
825.725781096656443
1653.207429169171740
2777.109648537486177
166.653023806101158
1747.004579272761952
651.111357603290468
242.210006732268284
34.266895846221599
286.7908645685911...

result:

ok 100 numbers

Test #10:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

100
0 -30 84 12 126 -72 42 -114
0 -30 84 12 126 -72 42 -114
91 -41 100 -55
96 93
168 110 148 150 48 100 68 60
48 100 68 60 168 110 148 150
61 96 102 90
8 2
-123 129 -60 174 -15 111 -78 66
-15 111 -78 66 -123 129 -60 174
-44 115 -104 132
27 3
27 42 15 54 -75 -36 -63 -48
-63 -48 -75 -36 15 54 27 42
-4...

output:

16.643316977093238
41.436698710201323
39.206555615733703
11.180339887498948
49.729267036625424
26.925824035672520
50.931326312987373
10.294055820165389
117.885537705012823
8.602325267042627
48.466483264210536
21.095023109728986
24.038404810405297
16.000000000000000
48.548944375753424
26.061756859551...

result:

ok 100 numbers

Test #11:

score: 0
Accepted
time: 1ms
memory: 4028kb

input:

100
9725 6731 9725 11971 14965 11971 14965 6731
9725 6731 9725 11971 14965 11971 14965 6731
10293 11185 10445 9833
488 10
3833 -4831 6913 -4271 8443 -12686 5363 -13246
6913 -4271 3833 -4831 5363 -13246 8443 -12686
5209 -4960 7133 -6409
1 88
-5891 -6066 -8365 -6066 -8365 -8540 -5891 -8540
-8365 -6066...

output:

1360.517548582156290
2119.674780139698552
1638.601494195408552
144.699689011414257
1706.299211744528703
2671.668018298680761
1442.324859385013859
2909.931270666027260
5311.386353862802927
7894.844203655953083
2950.721437208195700
1405.197279587166840
8052.785977535973233
436.084854128184553
1910.190...

result:

ok 100 numbers

Test #12:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

100
1432065 -1359744 1432065 -1359796 610089 -1359796 610089 -1359744
610089 -1359744 610089 -1359796 1432065 -1359796 1432065 -1359744
1413145 -1359747 670086 -1359765
306 12
-630899 -570942 344981 -570942 344981 -567164 -630899 -567164
-630899 -567164 344981 -567164 344981 -570942 -630899 -570942
...

output:

41383.003943812649979
344430.708764477038756
597464.947160122257515
57512.000021251275065
180112.504983949338978
254594.189465463647096
13301.834367630940076
246235.741341503873883
17086.953736696310257
168329.001188149393712
580568.278437601170310
120047.475965045275387
24722.575937794184476
252882...

result:

ok 100 numbers

Test #13:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

100
-240497 1168822 -365542 931192 504344 473443 629389 711073
226221 683190 167481 688085 185400 903113 244140 898218
-192129 1110656 34450 941656
2 25
1729381 25950 1512625 519672 1528369 526584 1745125 32862
1536820 492965 1580974 388601 1584302 390009 1540148 494373
1660204 207517 1601591 344571...

output:

33.523773639151383
126504.999518608850842
57518.293697332946682
318943.663702541675065
169769.250005668789626
1497.133893067348665
23459.324991965074714
853.347816095362503
28.351411845903801
7526.106524036450828
36705.816569039844751
575.015321675223630
4025.084882224933078
31458.023666467033797
31...

result:

ok 100 numbers

Test #14:

score: 0
Accepted
time: 1ms
memory: 3912kb

input:

100
-889209 606569 -191736 1436894 638589 739421 -58884 -90904
-58884 -90904 638589 739421 -191736 1436894 -889209 606569
-486300 891465 -464854 988546
79 18
-1226546 957048 -712144 1926170 -590407 1861553 -1104809 892431
-712144 1926170 -1226546 957048 -1104809 892431 -590407 1861553
-807239 146415...

output:

99421.584562910683879
404181.388824374247690
311311.528917577994662
271785.624537060458550
319158.191839094112879
77725.025543495047884
103690.241569289944856
33781.004277552199500
16708.608350188833127
262422.768227149071066
176381.843093329762382
159818.483940375307270
451836.634220813617361
29166...

result:

ok 100 numbers