QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#189146#4886. Best SunDualqwqTL 1621ms8908kbC++235.4kb2023-09-26 21:48:462023-09-26 21:48:48

Judging History

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

  • [2023-09-26 21:48:48]
  • 评测
  • 测评结果:TL
  • 用时:1621ms
  • 内存:8908kb
  • [2023-09-26 21:48:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 3e2 + 5;
typedef long long i64;
typedef double db;
typedef pair<int,int> pii;
#define FI first
#define SE second
const db eps = 1e-9,PI = acos(-1.0);
mt19937 Rnd(1919810);
struct Vec {
	int x,y;
	Vec(){}
	Vec(const int _x,const int _y):x(_x),y(_y){}
	inline Vec operator + (const Vec &rhs) const { return Vec(x + rhs.x,y + rhs.y);}
	inline Vec operator - (const Vec &rhs) const { return Vec(x - rhs.x,y - rhs.y);}
	inline i64 operator * (const Vec &rhs) const { return 1ll * x * rhs.y - 1ll * y * rhs.x;}
	inline bool operator == (const Vec &rhs) const { return x == rhs.x && y == rhs.y;}
};
Vec O(0,0);
inline bool Cmp(const Vec &x,const Vec &y) { return (x.x != y.x) ? (x.x < y.x) : (x.y < y.y);}
inline i64 Dot(const Vec &A,const Vec &B) { return 1ll * A.x * B.x + 1ll * A.y * B.y;}
inline db Distance(const Vec &A,const Vec &B) { return sqrt(Dot(A - B,A - B));}
inline db Area(const Vec &A,const Vec &B,const Vec &C) { return 0.5 * abs(A * B + B * C + C * A);}
inline bool Equal(const db &A,const db &B) { return fabs(A - B) < eps;}
inline bool InSegment(const Vec &A,const Vec &B,const Vec &p) { return Equal(Distance(A,p) + Distance(p,B),Distance(A,B));}
inline bool InTriangle(const Vec &A,const Vec &B,const Vec &C,const Vec &p) {
	if((B - A) * (p - A) >= 0 && (C - B) * (p - B) >= 0 && (A - C) * (p - C) >= 0) return true;
	if((B - A) * (p - A) <= 0 && (C - B) * (p - B) <= 0 && (A - C) * (p - C) <= 0) return true;
	return false;
}
inline Vec Rotate(const Vec &A) { return Vec(-A.y,A.x);}
inline int sgn(const Vec &A) { return A.x > 0 || A.x == 0 && A.y > 0;}
Vec p[N];
int n;
int V[N][N],VL[N][N]; 
int TagO;
db sum[N][N];
inline int NeedAdd(const Vec &A,const Vec &B,const Vec &p) {
	if(!InTriangle(O,A,B,p)) return 0;
	if(!p.x && !p.y) return 0;

	if((O - p) * (A - p) == 0 
		|| (O - p) * (B - p) == 0 || (A - p) * (B - p) == 0) return 1;
	return 2;
}
inline bool CheckTriangle(int i,int j,int k) {
	
	if(InSegment(p[i],p[j],p[k])) return VL[i][j] <= 1;
	if(InSegment(p[i],p[k],p[j])) return VL[i][k] <= 1;
	if(InSegment(p[j],p[k],p[i])) return VL[j][k] <= 1;
	int tmp = TagO - (p[i] == O) - (p[j] == O) - (p[k] == O);
	if(tmp && InTriangle(p[i],p[j],p[k],O)) return false;
	if(VL[i][j] || VL[j][k] || VL[i][k]) return false;

	int num = 0;
	int v1 = V[i][j] - NeedAdd(p[i],p[j],p[k]);
	int v2 = V[j][k] - NeedAdd(p[j],p[k],p[i]);
	int v3 = V[k][i] - NeedAdd(p[k],p[i],p[j]);
	if(p[i] * p[j] > 0) num += v1; else if(p[i] * p[j] < 0) num -= v1;
	if(p[j] * p[k] > 0) num += v2; else if(p[j] * p[k] < 0) num -= v2;
	if(p[k] * p[i] > 0) num += v3; else if(p[k] * p[i] < 0) num -= v3;

	return num == 0;
}

struct Line {
	int s,t,type;
	Vec v;
	Line(){}
	Line(const int _s,const int _t,const int _type,const Vec _v):
		s(_s),t(_t),type(_type),v(_v){}
	inline bool operator < (const Line &rhs) const { 
		// return atan2(v.y,v.x) < atan2(rhs.v.y,rhs.v.x);
		int t1 = sgn(this->v),t2 = sgn(rhs.v);
		if(t1 != t2) return t1 > t2;
		i64 val = this->v * rhs.v;
		// i64 val = atan2(rhs.v.y,rhs.v.x) - atan2(v.y,v.x);
		if(val) return val > 0;
		else return type < rhs.type;
	}
};
Line L[N * N * 2];
int tot;
inline void Init() {
	cin >> n;
	for(int i = 1;i <= n;i++) cin >> p[i].x >> p[i].y;
	TagO = 0;
	for(int i = 1;i <= n;i++) if(p[i] == O) TagO++;
	sort(p + 1,p + n + 1,Cmp);
	for(int i = 1;i <= n;i++) 
		for(int j = 1;j <= n;j++)
			if(i < j)
			for(int k = 1;k <= n;k++) {
				if(k == i || k == j) continue;	
				if(p[k] == O) continue;
				if(!InTriangle(p[i],O,p[j],p[k])) continue;
				V[i][j] += NeedAdd(p[i],p[j],p[k]);
				if(InSegment(p[i],p[j],p[k])) ++VL[i][j];
			}
			else V[i][j] = V[j][i],VL[i][j] = VL[j][i];
	for(int i = 1;i <= n;i++)
		for(int j = 1;j <= n;j++)
			for(int k = 1;k <= n;k++) {
				if(k == i || k == j) continue;
				if((p[k] - p[i]) * (p[j] - p[i]) <= 0) continue;
				if(Dot(p[j] - p[i],p[k] - p[i]) >= 0 && Dot(p[i] - p[j],p[k] - p[j]) > 0)
					sum[i][j] += min(Distance(p[k],p[i]),Distance(p[k],p[j]));
			}
	for(int i = 1;i <= n;i++)
		for(int j = 1;j <= n;j++) {
			if(i == j) continue;
			sum[i][j] += Distance(p[i],p[j]);
			L[++tot] = Line(i,j,0,p[j] - p[i]);
			L[++tot] = Line(i,j,1,Rotate(p[j] - p[i]));
		}
	sort(L + 1,L + tot + 1);
	cerr << 1.0 * clock() / CLOCKS_PER_SEC << endl;
}

db dp[N];
inline bool Check(int st,db mid) {
	for(int i = 1;i <= n;i++) dp[i] = -1e15;
	dp[st] = -eps;

	for(int i = 1;i <= tot;i++) {
		int s = L[i].s,t = L[i].t,tp = L[i].type;
		if(tp == 1) {
			if(s >= st) dp[s] -= mid * Distance(p[s],p[t]);
		} else 
			if(s >= st && t >= st && CheckTriangle(st,s,t))
				dp[t] = max(dp[t],dp[s] + Area(p[st],p[s],p[t]) - mid * sum[s][t]); 
	}

	return dp[st] > eps;
}
inline void Clr(int n) {
	for(int i = 1;i <= n;i++) for(int j = 1;j <= n;j++) V[i][j] = VL[i][j] = sum[i][j] = 0;
	tot = 0;
}
inline void work() {
	Clr(n);
	Init();
	static int perm[N];
	for(int i = 1;i <= n;i++) perm[i] = i;
	shuffle(perm + 1,perm + n + 1,Rnd);
	db ans = 0;

	for(int i = 1;i <= n;i++) 
		if(Check(perm[i],ans)) {
			db lef = ans,rig = 1e6;
			for(int _ = 1;_ <= 45;_++) {
				db mid = (lef + rig) / 2;
				if(Check(perm[i],mid)) lef = mid;
				else rig = mid;
			}
			ans = lef;
		}
	printf("%.10lf\n",ans);
	cerr << 1.0 * clock() / CLOCKS_PER_SEC << endl;
}
int main() {
	int T;
	cin >> T;
	while(T--) work();
	return 0;
}
/*
1
4
1 -4
3 -3
1 -1
2 1
*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3820kb

input:

4
3
-1 -1
1 -1
0 1
4
0 0
10 0
0 10
8 1
5
2 0
-2 0
1 1
-1 1
0 3
8
4 4
-4 4
4 -4
-4 -4
5 6
-6 5
-5 -6
6 -5

output:

0.3090169685
1.2368613993
0.2711375280
1.5631002030

result:

ok 4 numbers

Test #2:

score: 0
Accepted
time: 96ms
memory: 3900kb

input:

10000
3
702262 828158
-350821 -420883
-466450 13507
3
28647 -193498
126436 -864937
-287798 738936
3
270358 -269567
745815 -485408
834083 677952
3
-2036 -403634
742978 -263774
975937 -609237
3
584248 -472620
482016 -356760
284902 903881
3
-292004 504925
-935756 373793
-781101 -434659
3
-858513 684433...

output:

85789.0873983251
18268.5193616692
102489.9883902606
66685.7544280788
18674.6579373960
106468.9651319668
14427.0246510700
29966.2453025178
143547.7510835596
13097.1756881024
162410.1683169670
72070.9324178586
29369.9926278634
52867.2944310813
90314.3083467341
99775.9271965606
144449.7053083467
64406....

result:

ok 10000 numbers

Test #3:

score: 0
Accepted
time: 71ms
memory: 3872kb

input:

10000
3
2 2
2 -2
-5 -5
3
-3 5
5 -4
2 -2
3
-4 1
2 -2
-4 4
3
1 -4
2 1
-4 1
3
2 1
-1 1
-3 3
3
4 5
3 -1
-3 -3
3
1 5
5 0
5 -1
3
2 -3
-5 -3
5 3
3
-4 4
0 -5
5 4
3
2 -3
5 0
2 -5
3
-2 -3
5 -3
5 4
3
-1 4
4 4
4 3
3
5 3
-1 4
2 -1
3
2 -3
4 3
-4 3
3
0 4
-2 -2
-1 -3
3
-2 0
-4 -2
4 2
3
-3 -1
3 1
1 -3
3
2 -5
2 3
-4 ...

output:

0.6507006844
0.2268090498
0.4946825527
0.8255326236
0.2675324708
0.7379284455
0.1368529183
0.8277457937
1.3896280961
0.2484761410
1.0251262381
0.2252451168
0.7981688270
1.0521776233
0.2700907373
0.2210279888
0.6549291243
1.0657925316
0.1207361606
0.1727212009
0.4458825060
0.2484761410
0.1224985624
0...

result:

ok 10000 numbers

Test #4:

score: 0
Accepted
time: 112ms
memory: 3880kb

input:

5625
4
-405394 -381883
602267 -335687
-620806 984110
271283 531233
4
196903 -993060
290851 358123
-890076 -717709
-681138 209884
4
-849589 607722
-21517 -586295
208561 -220953
924518 622983
4
-832186 456270
289934 43656
636006 339718
188963 113907
4
-305762 -872205
-520125 368722
-774548 984204
4245...

output:

232625.0042744107
268175.8269859602
159589.3236305136
60440.7530425978
133893.1234363372
63201.9907486175
167697.6634061201
129470.0132843047
126903.8540727934
106643.9712630898
131692.3112278801
100421.0550162061
148490.2748178740
68842.2423098132
241376.1911161032
303904.5464356604
77462.333614761...

result:

ok 5625 numbers

Test #5:

score: 0
Accepted
time: 102ms
memory: 3864kb

input:

5625
4
-2 -1
4 -5
-2 -4
-4 -4
4
-1 -5
4 4
2 -5
-5 1
4
-3 -4
-3 -1
-5 -1
4 -2
4
-2 4
-4 1
-1 -1
5 -4
4
-3 -5
-1 4
5 -1
3 5
4
-4 -2
1 4
-1 1
3 4
4
-5 3
-3 3
5 -4
-1 4
4
1 2
2 -5
1 0
0 -3
4
-5 -4
2 -3
5 3
-3 2
4
2 -2
-4 3
1 -4
-5 -5
4
-3 5
-2 4
1 3
1 -4
4
0 -5
5 -5
0 -2
-3 2
4
0 5
-1 -4
-2 0
4 -1
4
4 -...

output:

0.4919681923
1.6080239096
0.6764635556
0.8146821129
1.5727954005
0.2020447880
0.4423672806
0.3055831996
1.5089069052
1.3227875115
0.5218559357
0.3982804344
1.2194946066
1.1774912423
1.3951026858
1.0737731202
0.7540897833
0.6075590875
1.4373192171
0.9671123280
0.9534878391
1.4836242599
1.2273730192
0...

result:

ok 5625 numbers

Test #6:

score: 0
Accepted
time: 146ms
memory: 3816kb

input:

3600
5
114127 146710
467065 -311758
189643 449065
-303893 -215009
-789281 -140748
5
-449893 654165
-899120 -560520
719351 652759
285007 471281
987628 -767128
5
-587522 89736
-355416 -178001
801765 512722
314119 -136906
350051 762194
5
85697 920768
161507 -533920
-536515 401333
-27632 -987465
112237 ...

output:

84655.1995486267
270848.7268670296
202824.0367340444
135615.1918739296
119666.5085434983
89811.8707706885
254983.1535752921
189662.7472664932
64951.6570894377
154748.4422910088
214519.6820790298
163467.5328002385
278857.2574408384
191490.4979058199
172625.5296426018
144947.5248148117
232735.62583867...

result:

ok 3600 numbers

Test #7:

score: 0
Accepted
time: 145ms
memory: 3884kb

input:

3600
5
2 6
-6 4
4 0
-5 0
3 1
5
0 3
5 -5
2 6
4 0
2 -4
5
2 -2
-6 -3
-5 -5
-1 3
-4 0
5
0 6
-3 -5
5 1
4 -3
-5 6
5
0 -6
-6 -5
-2 6
1 6
2 0
5
2 1
6 5
4 -1
-3 -2
-6 4
5
-1 -2
5 -6
-1 4
-2 3
6 4
5
-6 3
6 -5
4 -4
3 -1
2 -6
5
5 -4
1 -5
1 0
5 -1
3 2
5
-4 6
2 -4
1 -4
5 5
-1 6
5
-3 0
0 6
-2 5
-5 5
2 6
5
2 -1
-4 ...

output:

1.3917337982
1.0600076621
1.3386604777
2.1786414705
1.8677635263
1.2550644123
1.8197054424
0.9463023163
1.1316433017
1.5772390611
0.5212124113
1.5371795538
0.9473384695
1.0470909723
0.5572297823
1.2085970100
1.2302893708
0.6675741417
0.3665059865
0.6943425277
0.5121414101
0.4362963750
0.8610973339
0...

result:

ok 3600 numbers

Test #8:

score: 0
Accepted
time: 147ms
memory: 3888kb

input:

3600
5
-3 1
0 -1
2 -3
4 1
5 0
5
-3 -5
1 -5
-2 -2
3 2
1 5
5
-4 -2
4 5
5 3
2 -4
-4 0
5
0 4
-5 3
1 4
-1 1
4 1
5
5 -3
2 -5
-3 -4
-1 1
5 1
5
-5 5
-2 1
-3 2
2 2
-4 5
5
-2 -3
-1 3
1 1
3 -2
-2 -2
5
2 1
-2 -3
-3 -3
5 0
-5 4
5
2 2
-2 5
5 -1
4 -5
-2 4
5
-4 5
-1 -3
-2 5
5 -1
-4 3
5
-5 -4
-1 -3
0 -1
-5 1
-4 -3
5...

output:

0.5433808317
1.2079312626
1.5754945645
0.8075181374
1.5566795858
0.6824490536
0.9074401042
0.9508389924
0.8537708709
1.3713082012
0.7426407915
0.4014916044
0.7474276060
0.4934691447
0.7112144829
0.6092998319
1.2344361534
0.4338148128
1.4679333162
0.6954624357
0.6914801576
0.8433199810
1.1987088726
1...

result:

ok 3600 numbers

Test #9:

score: 0
Accepted
time: 132ms
memory: 3896kb

input:

3600
5
0 2
3 -7
7 3
-6 -1
6 -6
5
-3 6
-5 6
-10 -2
-4 -8
-9 8
5
-2 2
2 -9
6 -3
2 10
-5 7
5
-7 9
9 -4
-8 -2
4 10
9 -8
5
-8 -5
-10 0
-7 0
0 -7
6 8
5
10 -7
8 -8
3 1
0 -4
-7 -4
5
2 -9
-3 1
-4 -2
-3 -3
0 1
5
-8 5
-10 6
2 -8
6 -5
-6 8
5
5 8
-8 -9
3 -7
-9 0
-4 3
5
2 -5
2 0
6 7
10 5
-8 -6
5
-10 -2
7 -6
-10 5...

output:

2.1052009061
1.5367686501
1.6070202378
3.5263473037
1.9784334682
1.0825185655
0.9461632260
1.6023271002
2.8837721402
0.9408148756
1.7013625512
1.6009202284
1.9334872477
0.6918659460
1.8339842711
0.6306479613
3.4339518492
2.4487067378
1.5516660596
1.1454890227
0.8735166646
1.5938651359
1.4443102714
2...

result:

ok 3600 numbers

Test #10:

score: 0
Accepted
time: 204ms
memory: 4012kb

input:

900
10
-10 -1
8 -6
7 -1
-5 8
-7 -9
4 -2
-9 10
-10 -8
9 9
-3 -6
10
-5 9
-7 -1
-9 -7
-4 6
-5 2
1 -4
10 8
-9 -9
2 0
7 7
10
-3 -7
9 -4
-5 2
1 1
6 7
-4 7
4 -6
0 1
-8 -5
3 -5
10
-3 -10
-8 -7
-5 -5
-6 3
-3 -1
7 -9
1 -5
9 -7
-2 3
-4 9
10
0 1
-3 8
-3 7
4 -10
10 -6
-5 -8
10 4
4 3
0 -8
3 -10
10
4 -5
2 0
-5 -10...

output:

2.6060274616
1.2633417725
1.1838991013
0.8827284490
1.8782272963
1.5698135758
1.5532953085
1.6328323107
1.5737994700
0.9970959435
0.9424829834
1.4172826315
1.4017665589
1.6939866543
2.8628778400
2.0553597580
2.2087768401
1.3202393644
1.5058644636
1.5958000953
1.9530554880
1.1865717511
1.0563282438
2...

result:

ok 900 numbers

Test #11:

score: 0
Accepted
time: 199ms
memory: 3928kb

input:

900
10
670067 394291
-797310 -637136
-435933 -923795
120936 309795
-934569 -688829
950758 634654
983083 900196
174829 181896
-191047 177910
258020 672165
10
424046 -657491
391198 -14995
-302986 -597011
-96387 -486090
-164032 -356501
-891789 12548
-703186 -924511
808215 -212606
659523 490088
738901 5...

output:

81290.1618383761
91483.7331961564
100154.0270558288
192606.4148203155
177441.6474343962
76150.8923721530
177358.7053738782
230115.8792668010
280209.2628450219
61218.5430212863
137504.7916377183
168344.5440410775
162167.1818149082
133102.5292692311
177087.4563457209
163543.6097759702
184494.309868965...

result:

ok 900 numbers

Test #12:

score: 0
Accepted
time: 277ms
memory: 3884kb

input:

225
20
-4 -9
-5 3
7 -10
10 7
2 7
1 4
2 2
-5 -1
-9 -1
-3 10
-8 -6
0 -5
7 -4
-6 -8
-7 -5
-1 -7
-1 -3
8 -6
6 3
8 2
20
8 2
6 -8
-3 -6
-2 9
5 -2
0 8
8 0
-7 -9
3 1
4 -10
4 7
-6 -1
-8 -7
2 -8
-8 -1
1 -9
2 -10
1 2
-7 8
-10 3
20
5 8
0 -3
9 -9
-10 -4
-10 -2
9 10
-2 8
-6 -10
6 -6
-3 7
5 10
7 7
-5 -6
-2 3
-4 0
...

output:

0.6127869689
1.1137907047
0.7615364087
1.3308058924
0.7540492023
1.3328379562
0.6703147740
1.0353127785
0.9068173814
0.9769666403
0.7502848701
0.7780315720
0.7179049079
0.5715802265
0.7721060954
0.7692910036
1.8904459929
0.8600960440
1.0777332146
1.3129810863
0.8016468242
0.8696198919
0.8573236404
1...

result:

ok 225 numbers

Test #13:

score: 0
Accepted
time: 289ms
memory: 3964kb

input:

225
20
983700 -466859
-20884 -364855
807044 -308568
-785298 910840
-61173 -276993
-872226 -878552
-235162 831941
978289 938037
585612 -598517
545857 403231
-450887 -558997
-293044 -675226
-900628 102932
-836719 -530135
-534412 -681687
-487340 -227869
161252 -557533
397943 464720
170537 68556
413322 ...

output:

103902.0526005308
185063.0384573670
60443.6573723298
118360.3646096311
157018.7851307528
103511.4658062306
65549.6994792843
67043.3588288560
105010.2705326611
93450.0576684304
96005.2282075862
54350.0986012992
134718.5353431258
98397.3545701039
71213.2949663657
77465.3939447608
75212.0930408041
1236...

result:

ok 225 numbers

Test #14:

score: 0
Accepted
time: 74ms
memory: 4168kb

input:

6
50
-107573 -479674
-523931 117259
705403 519626
-802569 -162243
510741 876735
206326 -333274
448335 -276206
482965 -837837
873180 -965235
-359525 608790
-53827 782310
689038 -718590
739597 111296
420387 -953079
-492679 -243600
-929509 1174
800731 -968797
208236 193620
249265 499134
848153 771472
5...

output:

20480.3828539907
21190.0221497428
27821.6725958750
28113.3193405072
27223.9676079279
31857.8357100033

result:

ok 6 numbers

Test #15:

score: 0
Accepted
time: 347ms
memory: 4200kb

input:

36
50
569818 -279771
972561 928848
383 744221
-453534 -154445
293032 502859
744851 436690
293077 503053
657 744258
317135 -276665
293067 502799
277103 -439313
282010 -387735
276848 -439025
972274 928763
-110443 -507380
744799 436605
282061 -387926
-453689 -154326
317468 -276534
-453630 -154510
28193...

output:

81019.4274543900
77527.2587729765
55029.2464232970
42253.1543856479
72715.8578229830
197374.6307406484
37469.7225819150
66130.3529953546
54454.5978065044
125611.0883685093
71800.2062730302
87529.3367688031
143932.8876147885
95010.1346815080
86801.3479384790
106229.4888660928
99367.3086457640
93764.6...

result:

ok 36 numbers

Test #16:

score: 0
Accepted
time: 419ms
memory: 4204kb

input:

36
50
-767165 583573
-284890 -681002
-423448 -259226
-285077 -680913
-921552 -557651
-767105 583853
-423314 -259380
790075 -225214
-921537 -557431
-767305 583770
-767124 583508
-921629 -557448
-423530 -259463
-284954 -680837
-423426 -259294
-423469 -259099
-767302 583744
-921772 -557672
-423503 -259...

output:

36643.6054806122
73491.0580576212
355454.4402131585
76283.4915153361
114070.2207770395
102751.9423399148
346834.5085962259
142611.0579378420
246800.0671139112
131055.8866665709
22279.8879892107
215589.6576250686
83424.8688141510
51800.2345429529
43278.8616878893
278223.4837556089
81405.2167205085
25...

result:

ok 36 numbers

Test #17:

score: 0
Accepted
time: 362ms
memory: 6220kb

input:

36
50
-757926 470127
-757550 470454
250422 -395772
250548 -395869
568164 -704082
250417 -396082
-757845 470427
444672 170989
250387 -395875
250484 -395866
568177 -704202
-757558 470484
250530 -395763
250488 -395883
-757754 470201
250529 -396062
-757760 470255
568050 -704413
444991 171218
444963 1710...

output:

41461.4157312472
61470.3459020869
198910.9999673621
35019.3686454213
139342.5797078132
26339.6628390336
247086.6792489506
108103.8329786175
269038.9700572520
40491.2267640750
99838.8739582887
174035.1497371311
172811.2119707050
155604.8803015922
30013.6705970706
250614.3951947024
84144.5624718484
20...

result:

ok 36 numbers

Test #18:

score: 0
Accepted
time: 485ms
memory: 4708kb

input:

9
100
-79487 826724
571284 354748
-312616 727781
-838024 249391
-79475 826592
796988 -514208
-847898 -839919
584481 896431
-847899 -839656
-312680 727782
22798 138363
466409 -215121
-36729 -925283
677267 -733543
-789119 581936
-789111 581860
271104 629366
571356 354824
-946155 -832752
571238 354954
...

output:

23149.7505948886
20131.1691208605
50752.3036752992
22743.2512424801
21418.0199422458
24609.1329750499
20676.5752705786
23043.7559151672
35012.2203029299

result:

ok 9 numbers

Test #19:

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

input:

1
10
2 -999
3 -998
4 -995
5 -990
6 -983
7 -974
8 -963
9 -950
1000 1000
-1000 1000

output:

293.8271086932

result:

ok found '293.8271087', expected '293.8271087', error '0.0000000'

Test #20:

score: 0
Accepted
time: 707ms
memory: 8824kb

input:

1
300
-1000000 700000
-999999 697990
-999998 695960
-999997 693910
-999996 691840
-999995 689750
-999994 687640
-999993 685510
-999992 683360
-999991 681190
-999990 679000
-999989 676790
-999988 674560
-999987 672310
-999986 670040
-999985 667750
-999984 665440
-999983 663110
-999982 660760
-999981 ...

output:

46.7179453508

result:

ok found '46.7179454', expected '46.7179454', error '0.0000000'

Test #21:

score: 0
Accepted
time: 1195ms
memory: 8712kb

input:

1
300
-9999 -2
-9998 -3
-9995 -4
-9990 -5
-9983 -6
-9974 -7
-9963 -8
-9950 -9
-9935 -10
-9918 -11
-9899 -12
-9878 -13
-9855 -14
-9830 -15
-9803 -16
-9774 -17
-9743 -18
-9710 -19
-9675 -20
-9638 -21
-9599 -22
-9558 -23
-9515 -24
-9470 -25
-9423 -26
-9374 -27
-9323 -28
-9270 -29
-9215 -30
-9158 -31
-9...

output:

2367.6921379652

result:

ok found '2367.6921380', expected '2367.6921380', error '0.0000000'

Test #22:

score: 0
Accepted
time: 1313ms
memory: 8776kb

input:

1
300
700000 1000000
697990 999999
695960 999998
693910 999997
691840 999996
689750 999995
687640 999994
685510 999993
683360 999992
681190 999991
679000 999990
676790 999989
674560 999988
672310 999987
670040 999986
667750 999985
665440 999984
663110 999983
660760 999982
658390 999981
656000 999980...

output:

46.7179453520

result:

ok found '46.7179454', expected '46.7179454', error '0.0000000'

Test #23:

score: 0
Accepted
time: 1102ms
memory: 8716kb

input:

1
300
-2 9999
-3 9998
-4 9995
-5 9990
-6 9983
-7 9974
-8 9963
-9 9950
-10 9935
-11 9918
-12 9899
-13 9878
-14 9855
-15 9830
-16 9803
-17 9774
-18 9743
-19 9710
-20 9675
-21 9638
-22 9599
-23 9558
-24 9515
-25 9470
-26 9423
-27 9374
-28 9323
-29 9270
-30 9215
-31 9158
-32 9099
-33 9038
-34 8975
-35 8...

output:

2367.6921379694

result:

ok found '2367.6921380', expected '2367.6921380', error '0.0000000'

Test #24:

score: 0
Accepted
time: 1315ms
memory: 8712kb

input:

1
300
1000000 -700000
999999 -697990
999998 -695960
999997 -693910
999996 -691840
999995 -689750
999994 -687640
999993 -685510
999992 -683360
999991 -681190
999990 -679000
999989 -676790
999988 -674560
999987 -672310
999986 -670040
999985 -667750
999984 -665440
999983 -663110
999982 -660760
999981 -...

output:

46.7179453565

result:

ok found '46.7179454', expected '46.7179454', error '0.0000000'

Test #25:

score: 0
Accepted
time: 1210ms
memory: 8800kb

input:

1
300
9999 2
9998 3
9995 4
9990 5
9983 6
9974 7
9963 8
9950 9
9935 10
9918 11
9899 12
9878 13
9855 14
9830 15
9803 16
9774 17
9743 18
9710 19
9675 20
9638 21
9599 22
9558 23
9515 24
9470 25
9423 26
9374 27
9323 28
9270 29
9215 30
9158 31
9099 32
9038 33
8975 34
8910 35
8843 36
8774 37
8703 38
8630 3...

output:

2367.6921379535

result:

ok found '2367.6921380', expected '2367.6921380', error '0.0000000'

Test #26:

score: 0
Accepted
time: 1316ms
memory: 8804kb

input:

1
300
-700000 -1000000
-697990 -999999
-695960 -999998
-693910 -999997
-691840 -999996
-689750 -999995
-687640 -999994
-685510 -999993
-683360 -999992
-681190 -999991
-679000 -999990
-676790 -999989
-674560 -999988
-672310 -999987
-670040 -999986
-667750 -999985
-665440 -999984
-663110 -999983
-6607...

output:

46.7179453488

result:

ok found '46.7179453', expected '46.7179454', error '0.0000000'

Test #27:

score: 0
Accepted
time: 1214ms
memory: 8732kb

input:

1
300
2 -999999
3 -999998
4 -999995
5 -999990
6 -999983
7 -999974
8 -999963
9 -999950
10 -999935
11 -999918
12 -999899
13 -999878
14 -999855
15 -999830
16 -999803
17 -999774
18 -999743
19 -999710
20 -999675
21 -999638
22 -999599
23 -999558
24 -999515
25 -999470
26 -999423
27 -999374
28 -999323
29 -9...

output:

24.9160640993

result:

ok found '24.9160641', expected '24.9160641', error '0.0000000'

Test #28:

score: 0
Accepted
time: 527ms
memory: 8804kb

input:

1
300
2 -44999
3 -44998
4 -44995
5 -44990
6 -44983
7 -44974
8 -44963
9 -44950
10 -44935
11 -44918
12 -44899
13 -44878
14 -44855
15 -44830
16 -44803
17 -44774
18 -44743
19 -44710
20 -44675
21 -44638
22 -44599
23 -44558
24 -44515
25 -44470
26 -44423
27 -44374
28 -44323
29 -44270
30 -44215
31 -44158
32...

output:

479.3020660570

result:

ok found '479.3020661', expected '479.3020661', error '0.0000000'

Test #29:

score: 0
Accepted
time: 1188ms
memory: 8820kb

input:

1
300
2 -9999
3 -9998
4 -9995
5 -9990
6 -9983
7 -9974
8 -9963
9 -9950
10 -9935
11 -9918
12 -9899
13 -9878
14 -9855
15 -9830
16 -9803
17 -9774
18 -9743
19 -9710
20 -9675
21 -9638
22 -9599
23 -9558
24 -9515
25 -9470
26 -9423
27 -9374
28 -9323
29 -9270
30 -9215
31 -9158
32 -9099
33 -9038
34 -8975
35 -8...

output:

2367.6921379601

result:

ok found '2367.6921380', expected '2367.6921380', error '0.0000000'

Test #30:

score: 0
Accepted
time: 1198ms
memory: 8804kb

input:

1
300
2 -49999
3 -49998
4 -49995
5 -49990
6 -49983
7 -49974
8 -49963
9 -49950
10 -49935
11 -49918
12 -49899
13 -49878
14 -49855
15 -49830
16 -49803
17 -49774
18 -49743
19 -49710
20 -49675
21 -49638
22 -49599
23 -49558
24 -49515
25 -49470
26 -49423
27 -49374
28 -49323
29 -49270
30 -49215
31 -49158
32...

output:

7347.5787737188

result:

ok found '7347.5787737', expected '7347.5787737', error '0.0000000'

Test #31:

score: 0
Accepted
time: 1194ms
memory: 8720kb

input:

1
300
2 -99999
3 -99998
4 -99995
5 -99990
6 -99983
7 -99974
8 -99963
9 -99950
10 -99935
11 -99918
12 -99899
13 -99878
14 -99855
15 -99830
16 -99803
17 -99774
18 -99743
19 -99710
20 -99675
21 -99638
22 -99599
23 -99558
24 -99515
25 -99470
26 -99423
27 -99374
28 -99323
29 -99270
30 -99215
31 -99158
32...

output:

7264.8235486788

result:

ok found '7264.8235487', expected '7264.8235487', error '0.0000000'

Test #32:

score: 0
Accepted
time: 716ms
memory: 8772kb

input:

1
300
2 -999999
3 -999998
4 -999995
5 -999990
6 -999983
7 -999974
8 -999963
9 -999950
10 -999935
11 -999918
12 -999899
13 -999878
14 -999855
15 -999830
16 -999803
17 -999774
18 -999743
19 -999710
20 -999675
21 -999638
22 -999599
23 -999558
24 -999515
25 -999470
26 -999423
27 -999374
28 -999323
29 -9...

output:

80244.5137404324

result:

ok found '80244.5137404', expected '80244.5137404', error '0.0000000'

Test #33:

score: 0
Accepted
time: 1621ms
memory: 8908kb

input:

1
300
-582688 -338066
65950 664506
726195 -342195
778617 -357210
-854288 556277
300499 294357
643715 884595
145808 699895
823594 197029
-326906 -938477
-635849 -984773
-133686 656789
-435448 690719
903384 -472986
82595 315750
-162788 541714
-77694 -237304
-850565 -426412
248922 -808508
-719332 -6663...

output:

1478.8300558787

result:

ok found '1478.8300559', expected '1478.8300559', error '0.0000000'

Test #34:

score: -100
Time Limit Exceeded

input:

1
300
329399 -774056
-453420 -971922
-963389 -692906
-901061 -690960
-954671 -555749
954332 -856245
97920 127454
422794 -72309
402518 -482396
-274243 -242236
-63992 224700
841180 586025
-266496 -824730
-178245 -230280
680876 907784
553835 674598
89593 396532
143208 -684880
538608 -578116
-422477 757...

output:

972.4232802333

result: