QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202552#6542. Optimal Quadratic Functionucup-team1209AC ✓4896ms8760kbC++203.4kb2023-10-06 11:21:012023-10-06 11:21:01

Judging History

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

  • [2023-10-06 11:21:01]
  • 评测
  • 测评结果:AC
  • 用时:4896ms
  • 内存:8760kb
  • [2023-10-06 11:21:01]
  • 提交

answer

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")

using std::cin;
using std::cout;
using ll = long long;
using u64 = unsigned long long;
void IOinit() {
	std::ios::sync_with_stdio(false), cin.tie(0);
#ifdef zqj
	freopen("$.in", "r", stdin);
#endif
}
using db = __float128;
int T, n;
const int N = 100000;
const db eps = 1e-13;
db sgn(db x) { return x < -eps ? -1 : x > eps; }
db eq(db x, db y) { return !sgn(x - y); }
struct vec2 {
	db x, y;
	db norm() const { return x * x + y * y; }
	db arg() const { return atan2(y, x); }
};
vec2 r90(vec2 x) { return {-x.y, x.x}; }
vec2 operator + (vec2 x, vec2 y) { return {x.x + y.x, x.y + y.y}; }
vec2 operator - (vec2 x, vec2 y) { return {x.x - y.x, x.y - y.y}; }
vec2 operator / (vec2 x, db y) { return {x.x / y, x.y / y}; }
vec2 operator * (vec2 x, db y) { return {x.x * y, x.y * y}; }
vec2 operator * (db y, vec2 x) { return {x.x * y, x.y * y}; }
db operator * (vec2 x, vec2 y) { return x.x * y.y - x.y * y.x; }
db operator % (vec2 x, vec2 y) { return x.x * y.x + x.y * y.y; }

struct line : vec2 {
	db z;
	// a * x + b * y + c (= or >) 0
	line() = default;
	line(db a, db b, db c) : vec2{a, b}, z(c) {}
	line(vec2 a, vec2 b) : vec2(r90(b - a)), z(a * b) { }
	// 左侧 > 0
	db operator ()(vec2 a) const { return a % vec2(*this) + z; }
	line perp() const { return {y, -x, 0}; } // 垂直
	line para(vec2 o) { return {x, y, z - (*this)(o)}; } // 平行
};
vec2 operator & (line x, line y) {
	return vec2{vec2{x.z, x.y} * vec2{y.z, y.y}, vec2{x.x, x.z} * vec2{y.x, y.z}} / -(vec2(x) * vec2(y));
	// 注意此处精度误差较大,以及 res.y 需要较高精度
}

std::vector<vec2> cut(const std::vector<vec2> & o, line l) {
	std::vector<vec2> res;
	int n = size(o);
	for(int i = 0;i < n;++i) {
		vec2 a = o[i], b = o[(i + 1) % n];
		if(sgn(l(a)) >= 0) res.push_back(a); // 注意 sgn 精度
		if(sgn(l(a)) * sgn(l(b)) < 0) res.push_back(line(a, b) & l);
	}
	return res;
} // 切凸包
db x[N], y[N], sx[N];
std::pair<vec2, db> eval_d(db a, db b) {
	db min = y[0] - (a * sx[0] + b * x[0]), damin = -sx[0], dbmin = -x[0];
	db max = min, damax = -sx[0], dbmax = -x[0];
	for(int i = 1;i < n;++i) {
		db v = y[i] - (a * sx[i] + b * x[i]);
		if(max < v) max = v, damax = -sx[i], dbmax = -x[i];
		if(min > v) min = v, damin = -sx[i], dbmin = -x[i];
	}
	return std::make_pair(vec2{damax - damin, dbmax - dbmin}, max - min);
}


int main() {
	IOinit();
	cin >> T;
	for(int i = 0;i < T;++i) {
		cin >> n;
		for(int i = 0;i < n;++i) {
			int a, b; cin >> a >> b;
			x[i] = a;
			y[i] = b;
			sx[i] = x[i] * x[i];
		}
		if(n <= 3) {
			puts("0");
			continue;
		}
		const db V = 1e18;
		std::vector<vec2> v = { {-V, -V}, {V, - V}, {V, V}, {-V, V} };
		auto center = [&]() -> vec2 {
			vec2 sum = v[0];
			for(int j = 1;j < (int) v.size();++j) sum = sum + v[j];
			sum = sum / v.size();
			return sum;
		};
		db res = 1e6;
		for(int i = 0;i < 240;++i) {
			vec2 x = center();
			auto [d, tmp] = eval_d(x.x, x.y);
			res = std::min(res, tmp / 2);
			d.x *= -1, d.y *= -1;
			line L; L.x = d.x, L.y = d.y; L = L.para(x);
			v = cut(v, L);
			assert(v.size());
		}
		for(auto [x, y] : v) {
		//	std::cerr << "de " << x << ' ' << y << '\n';
		}
		// std::cerr << (double)res << '\n';
		printf("%.10lf\n", double(res * res));
		// cout << res * res << '\n';
	}
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

1
4
0 0
1 3
2 9
3 0

output:

5.0625000000

result:

ok found '5.0625000', expected '5.0625000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 332ms
memory: 8168kb

input:

60
1
1000 -990
2
171 -638
949 -99
2
633 227
-257 -602
3
634 -994
633 999
-374 995
3
445 -110
586 -121
462 29
9
-995 -224
-458 -833
691 -670
456 -259
-376 55
-563 -12
834 827
-826 -220
299 744
17
997 991
997 976
997 988
998 -986
999 -982
999 -980
999 -996
998 -988
998 -991
997 987
1000 996
999 -1000
...

output:

0
0
0
0
0
543160.1259963982
121.0000000000
0.8320061812
412780.6071794284
12.2500000000
15750.2500000000
118751.3800860984
880245.5054735196
1.0000000000
15.3633733603
854986.7131649868
20.2500000000
24567.6673810630
881031.5630210808
306.2500000000
0
0
181005481253.1223449707
7601049.0000000000
189...

result:

ok 60 numbers

Test #3:

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

input:

1000
1
-585478 527569
1
152984 679945
1
-174472 172630
1
235983 471538
1
-250372 650998
1
521028 -109032
1
121457 989514
1
916700 -223410
1
25908 939341
1
999032 369442
1
249207 -874185
1
-921949 719467
1
-692065 -756006
1
580461 644861
1
-382986 975568
1
644060 -113069
1
-588888 717169
1
2947 -3929...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #4:

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

input:

1000
2
578578 -462573
-614596 -50411
2
568651 926188
-15389 -281674
2
-56242 -213116
215036 310015
2
-568452 -743741
-314862 -573269
2
-428037 -926383
-172945 -31965
2
-58020 145819
-69585 116311
2
-629887 -794837
704590 -761914
2
243217 -433618
98814 -457689
2
147490 681479
665176 -119632
2
-851707...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #5:

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

input:

1000
3
-734917 -489090
419510 102330
712427 633246
3
36286 -456156
747264 -743132
260371 -674274
3
429263 14588
352092 -105774
547767 232534
3
-913665 328259
240305 -680653
-295994 -678964
3
597443 -368402
-231672 43641
-590555 396735
3
-603016 904082
-607928 649743
464117 526551
3
350193 -351624
33...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #6:

score: 0
Accepted
time: 524ms
memory: 5844kb

input:

1000
4
-48411 -514672
165369 -349660
-281244 -842990
50473 -422110
4
-487482 -318709
861670 -709796
-491931 -335068
-523699 -455262
4
-817575 -338873
869501 905839
-717462 -668516
841972 769497
4
530706 615905
128991 -871809
82920 -948448
-317630 -725769
4
144451 772470
-923425 791489
513030 193835
...

output:

0.0016352529
0.4418888937
0.0950875589
3655702.6519551063
769858.6658072715
876.9644181294
2.3833780352
0.0033143314
0.0460742900
0.4140870970
31534.7528370824
0.0115333108
1322109.7934399224
2475705.1418551505
5494047.0763826519
0.6047581117
36615.9822244345
15433.4438030229
0.0000134834
416.623552...

result:

ok 1000 numbers

Test #7:

score: 0
Accepted
time: 570ms
memory: 6100kb

input:

1000
5
-425128 981633
-381689 946206
957441 996145
84010 712860
-8814 738024
5
235841 662950
864929 -477349
823444 -108225
714735 661226
300163 983888
5
-972539 106077
-856485 556296
-951397 193386
-207377 778279
-862794 555900
5
-877483 818676
537271 -193411
341352 408858
167065 819835
451709 87895...

output:

162.2174235642
24899.7030373532
111166879.5564019531
440.6680439515
45502620.0264690518
0.9081657205
48119370.9382885993
1331743.1073600790
1145.0410446279
11911.4090896374
898995.9310639658
0.2814863986
7.8352654558
0.7705991738
1167.3057075314
40318098119.9603347778
643.4716812720
0.1447506035
459...

result:

ok 1000 numbers

Test #8:

score: 0
Accepted
time: 684ms
memory: 8248kb

input:

1000
10
860001 272235
-30508 220967
711207 504388
77794 647164
303746 959200
592742 534104
57277 254211
266565 968002
919148 568676
991753 -20796
10
95213 204518
35283 198770
69842 203724
-316246 248661
-319918 245804
-923990 767251
-689125 503455
175418 229272
90053 206083
-815528 637145
10
-808164...

output:

52855287328.7975769043
4736213.5450279377
325.2766040390
11692527.6193256974
61306.4670950678
24947264304.3305320740
492734951022.4921264648
0.9653457085
1913.4955040864
385.4746630475
6.4484451774
42078421804.7162780762
5867468.0156242335
0.6066720648
24254772.5148243979
863797.7294300187
9847186.3...

result:

ok 1000 numbers

Test #9:

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

input:

1
4
-1000000 -1000000
-999999 1000000
999999 1000000
1000000 -1000000

output:

0.0000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #10:

score: 0
Accepted
time: 2ms
memory: 7892kb

input:

1
4
-1000000 -1000000
-999999 1000000
-999998 1000000
-999997 -100000

output:

12656250000.0000476837

result:

ok found '12656250000.0000477', expected '12656250000.0000000', error '0.0000000'

Test #11:

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

input:

1
4
-1000000 -1000000
-999999 1000000
-999998 1000000
-999997 -1000000

output:

0.0000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #12:

score: 0
Accepted
time: 0ms
memory: 5892kb

input:

1
4
-1000000 -300000
-999999 300000
-999998 300000
-999997 -300000

output:

0.0000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #13:

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

input:

1
4
-1000000 -999999
-999999 999998
-999998 999996
-999997 -999999

output:

0.5625000003

result:

ok found '0.5625000', expected '0.5625000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 4ms
memory: 5840kb

input:

8
4
-1000000 -1000000
-999999 1000000
999999 999977
1000000 -1000000
4
-1000000 -1000000
-999999 1000000
999999 999770
1000000 -1000000
4
-1000000 -1000000
-999999 1000000
999999 997770
1000000 -1000000
4
-1000000 -1000000
-999999 1000000
999999 977770
1000000 -1000000
4
-1000000 -1000000
-999999 10...

output:

33.0625330625
3306.2533062525
310806.5608064831
30885837.1358294152
62499875000.0000000000
561097185.4489570856
0.5630629222
2770157895.4910011292

result:

ok 8 numbers

Test #15:

score: 0
Accepted
time: 43ms
memory: 5996kb

input:

50
20
-78760 901241
-290160 346799
-100100 886312
-400033 -7842
-128289 858428
-443380 -236792
-204313 613533
870820 96059
812309 226162
-35539 980448
797663 345545
-445875 -256648
-460410 -299719
627726 793426
832862 169452
656272 795052
-339551 196857
-34433 992148
-388395 11457
-255059 482328
20
...

output:

1995515551.2350506783
81676587.1627621204
15097.2399590814
23.3955124294
579359934.0024535656
3853.6636501781
50.3813829628
2611489.3654411123
131464690.0623990446
2137.8200371974
284.1439651299
564775635.7526507378
39822891364.8485794067
909.2738770305
16588.0635692720
2808332.0414655884
2945.34060...

result:

ok 50 numbers

Test #16:

score: 0
Accepted
time: 3534ms
memory: 6144kb

input:

500
300
-574218 -271807
-443150 -83950
15479 867073
-467689 -121944
-318587 129168
-24306 766466
-968754 -612160
-814705 -519500
-60831 677156
-195474 372912
-44244 717366
-134450 505915
-523893 -204101
-179966 405956
-732527 -448979
-886997 -569400
-190507 383431
-538163 -223837
-885831 -568677
-60...

output:

223.5739863086
11176.3428724752
1192.7447527642
453187006.5233571529
554031869.3622390032
9.2061590119
126.7131637666
2.7912251436
7790357819.2904272079
13298746917.7325820923
138873066385.7568664551
4982989809.2834615707
67327474.8779172897
4313.3500129224
2045627.9639904012
5494615758.9137706757
7...

result:

ok 500 numbers

Test #17:

score: 0
Accepted
time: 4311ms
memory: 8464kb

input:

2
100000
856014 -110712
-748941 799207
-390374 -391739
448342 -991095
-64136 -981770
583018 -785726
-94728 -935377
768587 -365471
-102072 -963217
-547043 88834
-57865 -990529
-569447 175470
-331771 -501999
-123570 -924764
-86739 -946110
-481573 -114452
-143293 -909698
-188793 -835029
-368557 -415082...

output:

1147482388.1930062771
27.0551807947

result:

ok 2 numbers

Test #18:

score: 0
Accepted
time: 2722ms
memory: 5824kb

input:

1000
100
-119975 -664365
949391 58457
740004 -370401
540289 -639167
-788110 721100
416862 -768862
-510399 -3617
-438471 -204422
-820344 865532
-788887 755411
601194 -601478
-489457 -66989
-702681 494011
581714 -590937
621839 -564798
-596490 195550
390610 -797275
-511753 -13584
-295498 -456173
260700...

output:

601442791.6493852139
24.8547250165
12179361657.9766349792
3766193.3766614283
162530385978.9398193359
12661609.4619679116
4212.8453670230
47746959069.0495986938
38556717282.9760131836
34153564.4400414228
109150.2321091631
20645.9451185168
1045764154.0942796469
4163.0314210713
1261167.0874389741
23131...

result:

ok 1000 numbers

Test #19:

score: 0
Accepted
time: 4896ms
memory: 6044kb

input:

1000
200
789124 -486241
-585609 207780
-420071 646265
-719341 -271629
798017 -517521
-358192 786061
882118 -897750
-572109 237809
584895 259362
-626674 62322
-504210 442329
-343020 802463
477414 549189
709507 -158428
802832 -539018
-273113 927143
639188 90473
-780485 -522065
330923 858488
719753 -19...

output:

91156684.2380880415
3501.1572597229
3851361410.7109718323
2454734.1597612812
5.0359050370
82.7683207154
284923642635.1637573242
380786260.8864848018
17.1675591090
5682477627.3977670670
4.4553159806
1265.2841033601
68.2794759336
1036.4975382396
2393.8191178805
791577964.2959988117
4.0459100583
236911...

result:

ok 1000 numbers

Test #20:

score: 0
Accepted
time: 4711ms
memory: 8092kb

input:

666
300
733074 -538691
-186759 708121
19954 783003
144458 730949
204506 673961
553123 25690
226219 653422
624395 -178962
414482 359209
438237 305003
-273026 615231
-614391 -107992
-400931 412346
-483918 233375
-285489 597497
582783 -58643
-327538 537216
514448 125717
347458 484719
806041 -811603
783...

output:

14218890.0344357006
1560980.9284449809
135793682616.9345550537
597586.3559623038
2293035.6454914054
29924753323.6438369751
102.6693863899
2001978.2251530418
32.6290737414
3.3220930853
12200829391.2316741943
204120702.9749404192
59027030680.1538238525
6296990.5451269811
32233.5791209851
371.583939728...

result:

ok 666 numbers

Test #21:

score: 0
Accepted
time: 4643ms
memory: 7880kb

input:

500
400
-357828 -511505
811629 806298
595389 228873
228176 -405417
-718847 -22231
43107 -557461
478070 -20663
375542 -203854
468039 -41469
224127 -408358
87768 -530964
-370957 -500036
518859 60735
-647687 -152816
762116 659689
-140768 -600992
-314127 -540262
691144 464427
-822638 195188
640167 33654...

output:

2164267.2831408167
60833.5449115965
30687521.1214683577
409369199255.8953857422
156645670.1573216915
1133.0288083227
1180.6145196365
9652051207.4354286194
1404312.1179832020
116471.2952698361
19045036850.0283164978
47077498545.7147369385
136739.8890827141
132245.8684577763
31307114740.9806709290
15....

result:

ok 500 numbers

Test #22:

score: 0
Accepted
time: 4571ms
memory: 6216kb

input:

400
500
-500380 -894037
849708 881783
-558459 209296
851475 918558
-514750 -630889
829936 476110
-549945 42354
787624 -354093
814192 160977
-502873 -848842
772553 -637093
832402 525820
777452 -545681
-516265 -602612
813882 154790
822592 328889
818427 245057
846509 816020
798227 -150855
-540278 -1459...

output:

336358.6828424172
739007712.3134707212
8062740.9438404851
46895.7258066491
6280.6371521813
18764.8177120336
4518783186.3621435165
163.2662770899
444006974975.4183959961
43.5452806127
8.7236819807
3172.4789447965
1539479650.0077462196
143.9553328840
2.6263731449
111439415.8704605550
3312829955.404668...

result:

ok 400 numbers

Test #23:

score: 0
Accepted
time: 4524ms
memory: 5996kb

input:

333
600
397147 736863
710330 449692
713165 445736
742693 406407
-80845 715759
-131224 681331
256197 788247
4673 760369
-636028 -4806
600988 576750
-287208 535378
644821 529254
699244 463843
-791164 -339893
804029 317447
-256744 568277
894333 169764
991373 -10561
701153 461309
-500555 240181
-655423 ...

output:

51526.6285828379
5144056.8317836961
1108984120.7972514629
536.9572749908
2.1814906111
2855000.5214270768
7.8950709168
26330215618.1767311096
70553.2226493867
4296.4612045554
158697.1646376622
27333878.0978136510
347065432.7872393131
11.7806913407
32965.3762558899
109260.5937247562
688912.9623484584
...

result:

ok 333 numbers

Test #24:

score: 0
Accepted
time: 4486ms
memory: 8056kb

input:

285
700
950915 -131859
287194 -348466
732575 15902
252777 -413880
216880 -487731
981137 -169278
536902 -34166
642935 14401
833007 -25394
549734 -25558
747152 12749
470592 -90277
905736 -83662
693698 19630
838447 -28990
954527 -136018
230712 -458599
739346 14424
369980 -213227
237154 -445291
106468 -...

output:

7872.4817251498
137.3236138352
7.3217634777
108838738.7277651876
143181888199.5293884277
180745.0309834383
3757486297.4518690109
49308496.0725665763
3.4212101249
3719.3950429044
5468199288.9226713181
36176108156.8920974731
167194.5343822438
4519810.7298913449
5.9426154854
372.1911450791
74495.649496...

result:

ok 285 numbers

Test #25:

score: 0
Accepted
time: 4470ms
memory: 6068kb

input:

250
800
215344 949751
609032 593146
-105838 241410
-305554 -651790
-63750 385360
190202 926700
977848 -964837
372668 969088
723821 235110
-183595 -65083
2137 579745
874313 -407943
-274645 -490837
-352061 -909644
-108768 230807
118691 831006
7827 594698
-353540 -918151
479010 860107
528736 775396
137...

output:

1220.6412786649
3841279.0900789127
12.5792845214
575705766647.1070556641
1558427.6978731120
103457223182.7333374023
3.1244421495
4899838959.0744218826
787527992820.6015625000
398.6003835127
102710.6079047789
213705230964.3804626465
101864.4593718772
7589694361.1958255768
400500237290.3595581055
3852...

result:

ok 250 numbers

Test #26:

score: 0
Accepted
time: 4428ms
memory: 6044kb

input:

222
900
159295 -261280
-490655 -364459
-564376 -402728
-604271 -425659
-11582 -247668
558244 -406118
307888 -296721
818686 -586122
623984 -445193
-316296 -295538
-829005 -584571
-271531 -282717
885932 -643583
-20565 -247759
944306 -697087
198978 -268580
189596 -266716
564738 -409799
652943 -463779
-...

output:

191.7977962231
888649.4829008302
2548.3129810444
237569579369.7017211914
24.7604320049
1529.4436123268
2001480394.4860222340
7281629.9242185494
50766.1109667220
168430563771.4246520996
806829.9774647534
1571.2777283267
6.7189469842
1568004021.3788874149
595.6390916744
569.6365309621
10773.2415116919...

result:

ok 222 numbers

Test #27:

score: 0
Accepted
time: 4442ms
memory: 6020kb

input:

200
1000
921973 -681192
106799 -803185
-788145 993628
-416714 -4302
967514 -643801
151959 -857032
914844 -693738
440285 -958716
76084 -767643
-234739 -342853
-783938 978294
88850 -779199
994748 -589724
547596 -955741
827485 -776166
-509420 218589
-103043 -577817
-480852 137104
-207939 -394029
636786...

output:

451896268.5358763933
7.0499672069
5671529.6514581200
664528040183.4121093750
85.1206509751
7648180137.9264039993
1992099913.6400732994
44806.0316785110
1741949577.0628063679
3.1916822321
59567996.3204486594
831472726.2865102291
5.0613395960
53358834.1608508900
39478.5823654432
192811310.5037348568
3...

result:

ok 200 numbers

Test #28:

score: 0
Accepted
time: 4299ms
memory: 6440kb

input:

20
10000
367451 -409708
455070 -596428
-849725 742244
471078 -632029
165323 -32253
-955469 715329
-923101 725677
481472 -655412
605011 -948267
-407637 634856
147682 -2823
212276 -113335
54592 143212
-915359 727879
-706038 746189
185824 -67108
-390828 623713
445008 -574302
488755 -671854
209758 -1088...

output:

4742.4174757353
5708564220.3756580353
173867306652.4382019043
262985.1232624879
430508202.9135321975
84862534.9186854362
880.5204048156
45696595.6200857908
315.4295545800
305020763584.9898681641
857.4476569508
138426330564.1414184570
7316.9119079541
81.1282070160
1490448.1695208342
340039422992.9048...

result:

ok 20 numbers

Test #29:

score: 0
Accepted
time: 4231ms
memory: 8472kb

input:

2
100000
456841 473364
686221 501790
971762 617932
-460757 766289
699 504584
432758 447040
374796 454319
572086 478648
-193285 584233
491439 463152
-248925 592962
990805 603449
271131 432749
632227 506041
663581 521394
835276 572284
-686905 908087
878120 545025
9952 525303
-230097 589015
520429 4563...

output:

1144656406.7275233269
2762.7060075806

result:

ok 2 numbers

Test #30:

score: 0
Accepted
time: 4450ms
memory: 5848kb

input:

200
1000
355997 447007
-647551 160906
135262 493431
-191209 471687
-123387 482560
-947728 -194956
456306 412695
-288271 408556
-590730 228483
29143 515969
136898 495379
-437761 347020
-414146 347047
665752 276974
-654078 154335
-196238 463226
531736 340356
811033 150173
-508933 298732
-699464 117175...

output:

453791424.3563768268
4.5004332303
349576359429.3489990234
56072644255.0238571167
472464940.0150262713
28.5455416478
3126.6078682710
16689736.8158579133
48476275650.2563323975
28360079.4806549065
13621103754.0564918518
260995817.0893783867
230480.3420003445
17.9854332682
368237.6444498177
15328.30562...

result:

ok 200 numbers

Test #31:

score: 0
Accepted
time: 4264ms
memory: 6392kb

input:

20
10000
-198525 -699168
735571 -956068
73682 -861911
668211 -965932
-925579 89819
-26783 -810274
-318416 -604594
-969046 153288
849510 -929129
-531191 -402219
900779 -912916
-569364 -361171
-388794 -542459
-274404 -640970
946191 -896402
-666538 -250493
762366 -950829
163122 -899613
-418908 -514429
...

output:

4765.8428912159
75778.4305356165
31472925652.5561408997
5541071814.0748643875
12531584794.7907276154
5.0345355057
79583249.1741555333
263.5791860439
2111504.0145833953
9220669.6709630862
8882473448.2148094177
58104345751.6488952637
51959698296.3694839478
600452154.7190185785
277944.1213403520
203564...

result:

ok 20 numbers

Test #32:

score: 0
Accepted
time: 4303ms
memory: 8616kb

input:

2
100000
856014 -110712
-748941 799207
-390374 -391739
448342 -991095
-64136 -981770
583018 -785726
-94728 -935377
768587 -365471
-102072 -963217
-547043 88834
-57865 -990529
-569447 175470
-331771 -501999
-123570 -924764
-86739 -946110
-481573 -114452
-143293 -909698
-188793 -835029
-368557 -415082...

output:

1147482388.1930062771
27.0551807947

result:

ok 2 numbers

Test #33:

score: 0
Accepted
time: 4432ms
memory: 8132kb

input:

200
1000
598099 -707590
-941332 986389
5924 437220
50660 372206
-2232 484704
714086 -980976
-43837 532989
508536 -466519
-628392 976403
172620 189199
607743 -717828
-246520 756652
526210 -527203
710937 -988627
-154755 656534
-583701 998460
-176700 691814
-631576 986748
364647 -162636
-294261 797353
...

output:

453829535.3239285946
692823.5004015249
64.5763783391
2231952899.8137893677
63034407.1254506260
3647385879.1334800720
6.2248579828
186588789039.7489624023
110362170.2829256654
159530.7207218500
126663613121.6273803711
22305462784.7276191711
28902219.0086661465
31.2836855487
16263.1228683544
427107.65...

result:

ok 200 numbers

Test #34:

score: 0
Accepted
time: 4304ms
memory: 6340kb

input:

20
10000
-18780 765100
-16479 784796
-91618 222362
-321261 -464328
-98405 179720
-118075 63905
-292267 -463429
-476200 -48911
-9084 849233
-245457 -409691
-584219 659685
-60673 433871
-309507 -467014
-340866 -450884
-284189 -458835
-110342 108100
-361323 -424772
-224549 -364719
-151040 -104483
-1817...

output:

4763.8825622623
639149.9661488732
242.8231088554
59436543748.1246795654
4270273352.0162415504
67629.0930091645
11.8524665301
55864092542.0953445435
640493117912.8789062500
20.4540423415
126703.7793114696
119.5540385781
268005677896.1119384766
153461770.8706641197
6.7480234665
204964.2773870516
39540...

result:

ok 20 numbers

Test #35:

score: 0
Accepted
time: 4277ms
memory: 8644kb

input:

2
100000
667236 867053
647992 281838
609793 -886361
669939 974744
632726 -227234
-932814 -95833
656494 508904
-931761 -101283
-920106 -475126
615659 -694328
-915575 -573803
-946181 317231
-929371 -157155
-929775 -165768
-942491 232024
-949438 402454
-957596 690336
-956627 664321
661259 652248
-91611...

output:

1150380510.8619058132
1299086484.2276237011

result:

ok 2 numbers

Test #36:

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

input:

1000
1
245453 -824575
1
-197246 459584
1
-77058 815906
1
955295 986048
1
-585478 -968190
1
841394 57242
1
31072 99690
1
-78510 -741530
1
-154867 214579
1
-457213 -295148
1
43615 356233
1
-726485 152984
1
617038 252507
1
-109879 -116490
1
784366 340245
1
-174472 452792
1
-320241 156688
1
310604 55116...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #37:

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

input:

1000
2
837672 609450
787258 -294767
2
-693446 -190985
578578 -816820
2
-614596 -59091
294336 20778
2
304609 676004
920176 -533309
2
664878 -452235
64349 568651
2
-563942 -237278
-848305 -535691
2
-80676 -348564
-709683 589367
2
-247490 201794
536850 492292
2
495278 -704083
-112641 430391
2
367097 -4...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #38:

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

input:

1000
3
-570109 -991378
708540 -14266
690167 732422
3
-734917 -591316
419510 850008
712427 -44056
3
480071 217466
16935 709765
449771 -84197
3
585910 467300
856872 36286
-872052 747264
3
-750019 -921263
592440 260371
720656 -34731
3
283023 433718
-660833 -628076
429263 407689
3
352092 -408368
547767 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #39:

score: 0
Accepted
time: 531ms
memory: 6096kb

input:

1000
4
120184 -522502
-335327 196533
73779 690679
-48411 -394182
4
-644460 -240894
165369 -80520
-281244 891853
50473 -18791
4
206293 283841
-892530 394320
-715834 407924
69350 30219
4
552269 -487482
957785 966227
723653 861670
994344 -491931
4
84983 -523699
34389 -678235
337086 -436448
544394 36516...

output:

327393699392.2625122070
37531261813.4573669434
8874485904.0731468201
212493502985.6217956543
7250999080.4940853119
20488573849.8212394714
23311394774.2451515198
99807117862.5820159912
23062617866.2811851501
38678994544.5344009399
446620731881.3886718750
103647334209.3029785156
13609574570.1318759918...

result:

ok 1000 numbers

Test #40:

score: 0
Accepted
time: 561ms
memory: 5844kb

input:

1000
5
712404 -123329
551103 -557818
-444534 677308
-425128 -168678
-645206 668205
5
-381689 -145355
957441 433315
84010 -845421
-8814 -382972
-370969 -741883
5
704980 -185588
-52471 -686827
819704 -25330
357980 637232
-308202 625145
5
670814 -452431
-36276 -447692
-388856 235841
-614697 598694
5410...

output:

152585381702.9826354980
85161480852.0815734863
364999857514.5432128906
38193794255.4942092896
442592874023.3034667969
674011877106.6879882812
248849198288.4966430664
41402592568.7888336182
143358726694.9002380371
160126916159.7424316406
91101172575.8471374512
58568477040.6234054565
122654438628.6789...

result:

ok 1000 numbers

Test #41:

score: 0
Accepted
time: 699ms
memory: 8244kb

input:

1000
10
719749 300237
450883 20532
-678730 -219264
464946 -623294
860001 669923
-740634 695666
-30508 -154290
711207 870176
77794 -897832
-501417 -86445
10
303746 -867968
592742 337531
57277 435153
266565 -71540
-353681 -318147
-306074 74757
-294888 950911
-629552 797293
919148 -373377
-979009 83731...

output:

210103325229.4695434570
444176313518.7574462891
506247807424.8065185547
354780679482.1292724609
539970632520.1389770508
249634350280.5765991211
571102826159.8836669922
94682708939.2580871582
394956981248.9613647461
548759596132.5042114258
425305158733.7406005859
399083667196.2448730469
665993146054....

result:

ok 1000 numbers

Test #42:

score: 0
Accepted
time: 2806ms
memory: 5844kb

input:

1000
100
503940 892207
-360030 127313
847901 620477
-119975 485357
949391 -85679
740004 570364
540289 -514498
-788110 -550152
416862 -170936
-510399 -85009
-438471 147817
-820344 -419709
-788887 268568
601194 -463858
-489457 -271701
-702681 -677706
581714 -98124
621839 -87515
-596490 -406601
390610 ...

output:

832396317046.9403076172
908077635051.9040527344
936028198571.4899902344
949110704399.3859863281
937906309420.6865234375
952314657587.1752929688
878145042402.4265136719
936442232024.3797607422
949072984456.8339843750
960108790191.9619140625
869632201029.2617187500
841869778848.4406738281
969425400751...

result:

ok 1000 numbers

Test #43:

score: 0
Accepted
time: 4648ms
memory: 6148kb

input:

20
10000
-70357 850317
169057 860123
-76514 365758
367451 -811104
455070 -974302
-849725 -438852
471078 444337
165323 383392
-955469 -385190
-923101 -943035
822734 820483
481472 -196437
605011 422553
-407637 417395
147682 623919
212276 -652188
54592 34985
-915359 -741686
-706038 559876
756062 94848
...

output:

998335142645.5997314453
999524805668.7115478516
999251785658.7473144531
999071955797.2658691406
999838447779.5698242188
999794592809.8304443359
999777663877.0847167969
999731012368.8854980469
999091893506.7468261719
999806895467.7951660156
999580030136.7962646484
998973163482.8488769531
998159895698...

result:

ok 20 numbers

Test #44:

score: 0
Accepted
time: 4590ms
memory: 8676kb

input:

2
100000
-881270 -944828
758910 763086
-633064 439558
456841 433295
-931368 900398
686221 166089
971762 -975992
-460757 -889713
699 -285680
432758 -962102
374796 91613
572086 -391394
-193285 30235
491439 -472937
-248925 -128543
990805 298778
271131 86955
632227 161868
663581 -201111
835276 543619
-6...

output:

999917382510.2434082031
999942779320.9829101562

result:

ok 2 numbers

Test #45:

score: 0
Accepted
time: 4643ms
memory: 6076kb

input:

20
10000
-425094 847211
-767600 257206
963661 16874
-198525 302520
735571 -382082
73682 -517571
668211 -172051
-925579 35046
-26783 -385936
-318416 509908
-969046 59168
849510 -162900
-531191 -757703
900779 -95896
-569364 16362
-388794 289214
-274404 -634358
946191 -404712
-666538 562872
762366 -158...

output:

999147486723.5473632812
999757756670.6166992188
998942975304.7268066406
999598229269.2436523438
998849702270.9047851562
999569489549.8458251953
999823989390.7839355469
998831139698.4589843750
999198313197.7022705078
999131611645.4724121094
999724637946.9880371094
998373816184.1180419922
998569715273...

result:

ok 20 numbers

Test #46:

score: 0
Accepted
time: 4613ms
memory: 8760kb

input:

2
100000
-172784 17214
787403 -903054
-558038 90674
856014 -453082
-748941 -507384
-390374 87370
134043 407622
448342 761942
-64136 650351
-25780 490841
583018 365150
-94728 -357856
768587 849980
-102072 48624
-965970 -736101
-547043 -759821
-57865 452464
-569447 527213
-331771 -267817
-123570 22008...

output:

999950865683.8077392578
999918261435.7966308594

result:

ok 2 numbers

Test #47:

score: 0
Accepted
time: 4634ms
memory: 6304kb

input:

20
10000
255021 844104
226042 591067
101909 731214
200648 -555486
-18780 210137
-933209 438563
893715 246413
-16479 -341671
-91618 -415054
257898 -37150
-760824 -702148
182696 905489
332607 62042
-727584 425665
-321261 472027
73358 -769385
431453 667930
709666 -39367
338111 496166
-98405 552342
4234...

output:

999570511629.6676025391
998784608815.3602294922
999198703255.4169921875
998727089694.0758056641
999060441264.5926513672
999711967923.6644287109
999867916998.0910644531
998877073732.4372558594
999220250945.0450439453
999379384042.4174804688
999552918049.9992675781
999306433365.4212646484
999009066616...

result:

ok 20 numbers

Test #48:

score: 0
Accepted
time: 4630ms
memory: 8760kb

input:

2
100000
507332 979256
-247328 494029
580211 706940
-675111 -345939
-468440 154539
602736 -956497
359547 826086
294218 385225
-100600 649605
-484319 908932
889314 540612
273310 -324319
667236 634873
171492 -464667
316985 -280435
851887 181581
647992 719899
257252 -72591
-292271 671957
-984341 931410...

output:

999886167158.5429687500
999942316699.0795898438

result:

ok 2 numbers