QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#401508#6436. Paimon Polygongrass8cowAC ✓630ms261272kbC++173.6kb2024-04-28 20:52:102024-04-28 20:52:10

Judging History

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

  • [2024-04-28 20:52:10]
  • 评测
  • 测评结果:AC
  • 用时:630ms
  • 内存:261272kb
  • [2024-04-28 20:52:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pb push_back
struct no{
	ll x,y;
	no(){x=0,y=0;}
	no(ll x_,ll y_){x=x_,y=y_;}
	inline db len(){return sqrt(x*x+y*y);}
	inline bool hf(){return x>0||x==0&&y>0;}
};
no operator - (const no &a,const no &b){
	return no(a.x-b.x,a.y-b.y);
}
no operator + (const no &a,const no &b){
	return no(a.x+b.x,a.y+b.y);
}
ll cro(no a,no b){return a.x*b.y-a.y*b.x;}
ll dot(no a,no b){return a.x*b.x+a.y*b.y;}
no st[1001000];int t1,t2,ip[1010000];
db ans;
vector<no>B;
bool vis[1001000];
void mk(vector<no>e,bool cg){
	sort(e.begin(),e.end(),[&](no a,no b){if(a.x!=b.x)return a.x<b.x;return a.y<b.y;});
	t1=t2=0;
	int Z=0;
	for(no z:e){
		Z++;
		if(t1&&st[t1].x==z.x)continue;
		while(t1>1&&cro(st[t1]-st[t1-1],z-st[t1-1])<=0)t1--;
		st[++t1]=z,ip[t1]=Z;
	}
	t2=t1;
	Z=0;
	for(no z:e){
		Z++;
		if(t2>t1&&st[t2].x==z.x)t2--;
		while(t2-t1>=2&&cro(st[t2]-st[t2-1],z-st[t2-1])>=0)t2--;
		st[++t2]=z,ip[t2]=Z;
	}
	int nn=e.size();
	for(int i=1;i<=nn;i++)vis[i]=0;
	for(int i=1;i<=t2;i++)vis[ip[i]]=1;
	B.clear();
	if(cg){for(int i=0;i<nn;i++)if(!vis[i+1])B.pb(e[i]);}
	else{for(int i=0;i<nn;i++)if(!vis[i+1])t1=t2=-1;}
}
db calc(){
	int ck=t1-1+(t2-t1-1);
	if(st[1].y!=st[t1+1].y)ck++;
	if(st[t1].y!=st[t2].y)ck++;
	if(ck<3)return -1;
	db su=0;
	su+=(st[t1+1]-st[1]).len();
	su+=(st[t2]-st[t1]).len();
	for(int i=1;i<t1;i++)su+=(st[i+1]-st[i]).len();
	for(int i=t1+1;i<t2;i++)su+=(st[i+1]-st[i]).len();
	return su;
}
bool ck(int L,int R,ll x,ll y){
	if(L==R)return 0;
	no a=no(x,y);
	int l=L,r=R-1,zp=-1;while(l<=r){
		int mi=(l+r)>>1;
		if(x>=st[mi].x)zp=mi,l=mi+1;else r=mi-1;
	}
	assert(zp!=-1);
	return cro(st[zp]-a,st[zp+1]-a)==0;
}
bool isi(ll x,ll y){
	if(x<st[1].x||x>st[t1].x)return 0;
	if(x==st[1].x&&st[1].y<=y&&y<=st[t1+1].y)return 1;
	if(x==st[t1].x&&st[t1].y<=y&&y<=st[t2].y)return 1;
	return ck(1,t1,x,y)||ck(t1+1,t2,x,y);
}
bool chk(no a,no b,no c){return cro(b-a,c-a)>0;}
int n;no a[1010000];
void sol1(){
	vector<no>A;A.pb(no(0,0));
	for(int i=1;i<=n;i++)A.pb(a[i]);
	mk(A,1);
	db sA=calc();if(sA<0)return;
	for(no t:B){
		if(t.x==0&&t.y==0)return;
		if(isi(t.x,t.y))return;
	}
	B.pb(no(0,0));
	mk(B,0);if(t1==-1)return;
	db sB=calc();if(sB<0)return;
	ans=sA+sB;
}
no b[1001000];
db vl[1001000],f[1010000][20];
int L[1010000],R[1010000];
int lg[1010000];
db ask(int l,int r){
	int k=lg[r-l+1];
	return max(f[l][k],f[r-(1<<k)+1][k]);
}
void sol2(){
	sort(a+1,a+n+1,[&](no a,no b){if(a.hf()!=b.hf())return a.hf()<b.hf();return cro(a,b)>0;});
	for(int i=1;i<=n;i++)b[i]=b[i+n]=a[i];
	db os=0;
	for(int i=1;i<=n;i++){
		if(cro(b[i],b[i+1])==0&&dot(b[i],b[i+1])>0)return;
		os+=(b[i+1]-b[i]).len();
	}
	for(int i=1;i<n*2;i++)vl[i]=-(b[i+1]-b[i]).len()+b[i].len()+b[i+1].len(),f[i][0]=vl[i];
	for(int j=1;j<20;j++)for(int i=1;i+(1<<j)<=n*2;i++)
	f[i][j]=max(f[i][j-1],f[i+(1<<(j-1))][j-1]);
	for(int i=1,j=1;i<=n*2;i++){
		j=max(j,i);
		while(j<n*2&&cro(b[i],b[j+1])>0&&(j==i||chk(b[j-1],b[j],b[j+1])))j++;
		R[i]=j;
	}
	for(int i=n*2,j=n*2;j;i--){
		j=min(j,i);
		while(j>1&&cro(b[j-1],b[i])>0&&(j==i||chk(b[j-1],b[j],b[j+1])))j--;
		L[i]=j;
	}
	for(int i=1;i<=n;i++){
		int l=max(L[n+i]-1,i+2),r=min(n+i-2,R[i+1]);
		if(l>r)continue;
		ans=max(ans,vl[i]+ask(l,r)+os);
		//断掉边(i,i+1),则选择i+1<=j<n+i,j<=R[i+1],L[n+i]<=j+1 
	}
}
void sol(){
	ans=0;
	scanf("%d",&n);ll X,Y;
	for(int i=1;i<=n;i++)scanf("%lld%lld",&X,&Y),a[i]=no(X,Y);
	sol1(),sol2();printf("%.12lf\n",ans);
}
int main(){
	lg[0]=-1;
	for(int i=1;i<=1000000;i++)lg[i]=lg[i>>1]+1;
	int T;scanf("%d",&T);while(T--)sol();
	return 0;
}

详细

Test #1:

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

input:

3
4
0 3
3 0
2 3
3 2
5
4 0
5 -5
-4 -2
1 -2
-5 -2
4
0 1
1 0
0 2
1 1

output:

17.211102550928
36.632694762137
0.000000000000

result:

ok 3 numbers

Test #2:

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

input:

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

output:

14.324555320337
0.000000000000
30.689644794436
18.748224025700
30.254012217852
27.821068291827
36.632694762137
33.409725867074
29.556214635434
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000

result:

ok 14 numbers

Test #3:

score: 0
Accepted
time: 7ms
memory: 65464kb

input:

100
6
-4 1
-1 4
1 4
-4 -1
-2 3
3 2
7
-5641417 962017
-5641417 -962017
-5719589 193284
-5693492 -578972
-5693492 578972
-5563601 1340673
-5719589 -193284
9
-25 55
58 15
-13 14
-1 19
-60 6
-17 8
11 15
16 58
16 11
10
398546 -221163
-87181 -447383
-221163 -398546
-467649 -57196
55334 -452427
-427086 -19...

output:

25.114168051656
24824262.683584764600
359.109758585846
3042924.921086786315
547.754162500890
62188.886266667039
34663049.530452460051
51604481.697992786765
2264792232.411318778992
69911.177769532718
6924993.002383588813
27901.960485940570
0.000000000000
68869955.920005097985
741423.314793147147
3516...

result:

ok 100 numbers

Test #4:

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

input:

100
5
-1 3
-3 -1
-2 -2
-2 2
-3 1
10
12304563 85714062
39425590 -77096858
-41257504 76132260
-63303220 -59084727
-14839769 -85311687
77575790 -38474659
85621241 -12934672
55622697 66365791
83459695 -23082068
21276755 -83938086
8
2890069 4853907
-4693652 -4650419
2902770 -2219431
-3844676 8770039
5979...

output:

16.809836694575
787989807.665995359421
0.000000000000
1990.271775630684
0.000000000000
56.625430317853
38028.264099990854
535.665945559042
235257.867558373138
180.950513806061
602881.371128721861
46.484916049376
4110.465944783206
7564262751.121731758118
46670198.118715249002
2588369380.216481208801
...

result:

ok 100 numbers

Test #5:

score: 0
Accepted
time: 7ms
memory: 67388kb

input:

100
8
11998 28379
-21628 21945
-11714 -4752
92 12641
21945 21628
-4752 11714
-30810 224
-11643 4922
4
753 -34290
34290 753
24779 -23714
-23714 -24779
5
-10003 94641
47536 82445
86918 38759
63721 -70687
8533 -1809
10
-2 -4
5 2
7 7
10 -2
9 -5
-5 10
1 -5
4 -9
5 1
7 -7
7
47999701 49571963
-18823337 -785...

output:

172915.499171505857
189693.698725151393
500121.888946058927
0.000000000000
404174872.603922307491
0.000000000000
7627885.172423798591
19929200.338799312711
0.000000000000
383750556.971731185913
217740941.878957629204
54.003786735005
469600775.601401686668
5373804146.858261108398
3096896.534960814752...

result:

ok 100 numbers

Test #6:

score: 0
Accepted
time: 242ms
memory: 65600kb

input:

100000
8
-821105972 997119455
155098008 -782026135
999422988 -96073894
-199413884 -677661014
-198376812 -103268925
-871949583 -113805666
-870766708 -124679611
403309120 -797553920
10
-2884 -5808
-5808 2884
-4129 -698
6729 2528
-2992 2930
-2930 -2992
-3003 5746
-1081 6393
-3712 -1940
-4143 612
9
-561...

output:

6635241621.237134933472
0.000000000000
0.000000000000
47255.502413963644
22167105.492827922106
26656.776884298455
6358960.554756295867
4832622736.321642875671
400102464.605983376503
23350.809984829721
61.436353692862
5471759482.636210441589
0.000000000000
365216943.633044958115
0.000000000000
459002...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 235ms
memory: 65476kb

input:

100000
7
-84569 -1335
-84569 1335
-84485 4004
-84064 9328
-84317 6669
-84317 -6669
-84485 -4004
10
-40519 -84451
-12439 -92838
16858 -92138
-82419 -44505
67796 -64633
44505 -82419
-92138 -16858
-64633 -67796
-92838 12439
84451 -40519
5
-179830577 -368089311
-311590524 265970154
-180691219 -367667595...

output:

351672.376295571739
609117.893083088100
2330879690.656548500061
0.000000000000
2229.104078298693
59330.556513498210
5485547315.983452796936
140956853.334252893925
1784480.610534650739
105097.148059615720
29148820.196410108358
588.104355504545
0.000000000000
67.337556230195
77628337.701385259628
4396...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 249ms
memory: 65412kb

input:

100000
10
-495 -4668
12809 -60550
-25228 -56515
2343 -4067
4592 972
61545 -6529
45953 -41457
4067 2343
41457 45953
4286 -1913
5
-1 1
-6 -4
-2 7
0 1
-7 0
9
424 2599
-2633 -34
-1610 2708
-2439 1994
-2485 869
-490 2587
-8431 -4475
2463 932
1540 2748
10
-61374124 55073193
-10832626 18689337
-21487249 22...

output:

314284.717111179489
33.435849478834
0.000000000000
439149979.054863631725
0.000000000000
1742.349180776523
3433559646.163061618805
384890.231494063861
762965398.387161850929
2653519784.954759120941
4087583.773693069350
64069.817533092639
4204972630.124805450439
200793907.989355683327
38.748311323421...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 142ms
memory: 65572kb

input:

10000
69
68112 24117
75386 -44718
72082 -5016
70727 -14784
71327 -11549
34769 63341
43070 58017
72235 -1730
-19413 69599
54942 -46928
22721 68591
70762 14618
8484 52702
72239 1560
69090 -21154
37138 -25834
71354 11382
65566 -30365
70023 17823
16877 -30306
-16225 70411
66944 27192
69139 20992
68056 -...

output:

0.000000000000
0.000000000000
0.000000000000
1463971750.391668796539
0.000000000000
5926392251.286205291748
0.000000000000
638995324.567764997482
0.000000000000
0.000000000000
431.006446842663
0.000000000000
0.000000000000
0.000000000000
587573422.285766720772
0.000000000000
13473064.608146131039
0....

result:

ok 10000 numbers

Test #10:

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

input:

10000
89
460198758 -887815917
-434148529 -900841304
520821786 853665430
257666304 -966233965
956851104 -290578672
986823532 -161800235
-409214522 -912438204
-726504924 -687161258
900250170 -435372979
-718495391 -695531720
-304083796 -952645288
850068309 526672451
944531956 328419525
-821343849 57043...

output:

10243692462.277271270752
0.000000000000
6570171297.248271942139
7077996985.193793296814
9410898397.305908203125
9489932941.589429855347
6163709528.895239830017
9671708845.120178222656
6634363179.909983634949
7087210213.925824165344
6070552363.720861434937
9404754486.236656188965
0.000000000000
61254...

result:

ok 10000 numbers

Test #11:

score: 0
Accepted
time: 170ms
memory: 67448kb

input:

10000
74
180466154 -86208859
862406835 506215814
935552786 353186898
999777187 -21108670
196365784 -37953641
86208859 180466154
183962356 -78471981
122294399 158253215
542361280 -840145369
988963685 148158124
791266074 -611471994
431254957 -902230105
883114186 469158113
63521397 997980477
997980477 ...

output:

5981211006.363848686218
6062816628.611254692078
5282468120.911981582642
4916606482.272517204285
5851908848.899407386780
0.000000000000
5836142327.353197097778
0.000000000000
5891667483.097361564636
0.000000000000
0.000000000000
5573040287.467214584351
5683480737.550443649292
5879369771.372247695923
...

result:

ok 10000 numbers

Test #12:

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

input:

1000
483
-496268 -429424
63216 653215
-248508 841108
-550897 356650
-550119 -357849
-826730 292806
-652567 69586
-633814 170195
273911 833181
-557751 345833
-471290 456697
180478 630963
-252946 -605562
-622319 -208341
-861137 166318
-852675 205340
-876801 -20919
-651085 82305
27563 876618
-522725 70...

output:

0.000000000000
0.000000000000
0.000000000000
11879686.207704609260
460290.373928032699
0.000000000000
0.000000000000
2891421.524634769186
0.000000000000
6095598345.914842605591
0.000000000000
0.000000000000
0.000000000000
8802401426.098974227905
4697770.622933812439
63130411.858480781317
0.000000000...

result:

ok 1000 numbers

Test #13:

score: 0
Accepted
time: 156ms
memory: 69572kb

input:

1000
131
-350223990 936665979
239383029 970925211
441764873 897130869
-967985084 251007722
505110362 863054762
420125253 907466127
-776589506 -630006936
-987576231 157140662
-709986788 704214996
-22065711 999756523
-891769383 452490185
-726669234 686987499
-939493471 342566807
-978906416 204309151
3...

output:

7069732473.350296974182
7138209250.779088973999
10281890387.302669525146
0.000000000000
0.000000000000
0.000000000000
10222717940.222581863403
10263109914.444309234619
0.000000000000
0.000000000000
10281528585.623367309570
7087477367.054445266724
7134047957.917993545532
9138781001.223384857178
0.000...

result:

ok 1000 numbers

Test #14:

score: 0
Accepted
time: 177ms
memory: 65492kb

input:

1000
235
991460231 130409395
313622638 389410889
-483125428 -875551153
919512747 -393060184
997568782 -69688769
921779268 387715076
-229772984 -444076993
405359934 292717140
-208571721 -978007074
948050264 -318120568
490996298 -94459700
-253179770 -431161228
734591470 678509670
891205838 -453599111
...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
7207037940.147850036621
0.000000000000
0.000000000000
7666076521.185236930847
0.000000000000
7302977064.120658874512
7221131942.050683975220
7645676182.017140388489
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
...

result:

ok 1000 numbers

Test #15:

score: 0
Accepted
time: 180ms
memory: 72124kb

input:

100
9717
91016 27500
-59348 -36879
-31707 -73861
49436 81232
98144 7321
-63956 14795
-73417 -19074
-88081 -16285
-25791 -83401
91227 57975
47953 -90446
-70817 -14511
73804 -90134
-17632 -11464
7182 -57979
-33282 -50311
19595 85301
-24814 -67172
-5528 13211
44635 52594
27961 -89090
71109 -15391
17580...

output:

0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
71386189.597564280033
0.000000000000
0.000000000000
75401247.266974374652
0.000000000000
0.000000000000
0.000000000000
0.000000000000
71404303.688243255019
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.0000000...

result:

ok 100 numbers

Test #16:

score: 0
Accepted
time: 183ms
memory: 67576kb

input:

100
176
471091865 882084154
713147179 701014337
-890352156 455272488
-620765782 783996074
-592387596 805653111
486761146 873535109
-98361129 995150787
-946081685 323928147
289953885 957040618
-439928986 898032565
390595510 920562408
-423829910 905741800
-204174313 978934548
-358135160 933669753
3574...

output:

7105851504.975862503052
10280990546.463232040405
10280798418.894565582275
10281888221.244915008545
10280384358.682670593262
10281373658.548257827759
7139905346.506213188171
10279388822.325054168701
0.000000000000
10278460756.190336227417
10240416793.680742263794
0.000000000000
7140929577.70320987701...

result:

ok 100 numbers

Test #17:

score: 0
Accepted
time: 197ms
memory: 69688kb

input:

100
7098
-71865306 -291265133
-798257386 -602316483
-997899909 -64774781
-206612518 217511534
-703670771 -710526176
-971411529 237401857
301283615 -953534574
-49351231 -998781486
-269036995 132736941
-206332716 -217776974
-967516364 -252808398
-920939112 -389706495
-851875563 -523744236
-988866926 -...

output:

6683229061.342861175537
6674026094.847978591919
6681416033.052425384521
6682682546.377040863037
0.000000000000
6682987238.494940757751
6681864808.016559600830
6682255842.858544349670
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
0.000000000000
6671981158.008699417114
667...

result:

ok 100 numbers

Test #18:

score: 0
Accepted
time: 97ms
memory: 79612kb

input:

10
4039
-593515472 -804822580
-13746130 -299684908
291954058 -69013244
-979059216 -203575665
-999738014 22888955
989949562 -141420874
-915108823 -403206946
148968912 -260400198
298287653 -32007438
89853285 -286227859
-991818534 -127655774
251664674 -967814492
-184560882 -236510636
-933202631 -359350...

output:

6681347004.798379898071
6659220064.449930191040
0.000000000000
7141342168.351757049561
0.000000000000
6682227777.609680175781
10279237142.309631347656
0.000000000000
0.000000000000
0.000000000000

result:

ok 10 numbers

Test #19:

score: 0
Accepted
time: 103ms
memory: 86964kb

input:

10
2242
-947564084 -319565809
-248024701 -968753708
-832437517 -554118923
-249381919 -968405214
307590784 -951518738
-273725533 -961807846
347306610 -937751630
744328243 -667813946
-964815804 262926728
-862172282 -506615195
-416870938 -908965688
-962851651 -270030922
-945758049 -324871842
-933297219...

output:

8388984493.098008155823
8414153822.351839065552
10282636866.544940948486
10282721178.594314575195
7141450732.434858322144
7141399171.132284164429
0.000000000000
7141353594.173273086548
7141035278.395191192627
7141339757.735809326172

result:

ok 10 numbers

Test #20:

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

input:

10
43750
-545508884 -838105040
-294311431 -270888873
531862918 -846830465
306435136 -257094355
-920099201 -391685411
959735198 -280906300
372266028 -146348914
39536441 -398041292
543848949 -839183127
41936635 -397795574
536234042 -844069341
-227127089 -329261728
-170657925 -985330337
852976463 -5219...

output:

0.000000000000
7196637126.343395233154
7197071555.263933181763
7187682514.612198829651
7197620133.575387001038
7197448259.851585388184
7197489500.923151016235
7197121407.398585319519
0.000000000000
0.000000000000

result:

ok 10 numbers

Test #21:

score: 0
Accepted
time: 390ms
memory: 237452kb

input:

2
470540
945771735 -324831996
-610520187 792000695
115344233 993325580
237202620 971460198
597403696 801940661
979188425 202953266
935483233 353371082
955539043 294864609
-667883396 744265926
-606769585 794877771
798629875 -601822500
-272970990 962022265
990363889 -138489591
178875583 983871702
-397...

output:

0.000000000000
0.000000000000

result:

ok 2 numbers

Test #22:

score: 0
Accepted
time: 630ms
memory: 261272kb

input:

2
434459
526752980 850018410
453309897 -891352982
971480538 237119303
-4478154 -999989973
89533680 995983795
-552572316 -833464958
-997436773 -71553359
-999070516 43105731
-929875231 -367875054
936485292 350706855
709414652 -704791353
893786148 -448493391
983391270 -181498235
-970976140 239176369
-8...

output:

0.000000000000
0.000000000000

result:

ok 2 numbers

Test #23:

score: 0
Accepted
time: 162ms
memory: 156044kb

input:

2
19821
-965236966 261376355
81055674 996709575
-125539742 272469766
246114411 171545029
-41191850 297158596
29336692 298562152
179855994 983692951
812511053 582945786
222547826 974921774
-801190057 598409971
560767794 827973116
286869774 87782305
-488362309 872640966
-2664649 299988166
187255147 23...

output:

0.000000000000
0.000000000000

result:

ok 2 numbers

Test #24:

score: 0
Accepted
time: 115ms
memory: 67452kb

input:

50000
8
0 -28
-9 20
-19 11
-22 4
-23 0
-22 -4
-19 -11
-9 -20
15
0 -16
8 -15
18 -12
25 -9
26 0
25 9
18 12
8 15
0 16
-8 15
-25 9
-26 0
-25 -9
-18 -12
-8 -15
7
-6 14
-9 12
-18 5
-21 0
-18 -5
-9 -12
-6 -14
15
0 -21
6 -20
13 -15
20 -9
25 0
20 9
13 15
6 20
0 21
-6 20
-13 15
-20 9
-20 -9
-13 -15
-6 -20
7
0...

output:

153.595886484744
227.697117513458
105.990197063481
205.805490275555
110.668173929175
99.077048098902
145.561257470409
113.773964060301
120.052251374223
189.900200543750
154.402401476229
251.074035490542
246.726789664138
171.022864557452
132.698786954206
226.489143355378
164.654752677761
134.74569834...

result:

ok 50000 numbers

Test #25:

score: 0
Accepted
time: 75ms
memory: 67408kb

input:

10000
36
0 -295
26 -294
55 -283
72 -274
94 -261
111 -249
140 -228
155 -217
180 -196
207 -171
223 -150
236 -130
242 -117
245 -109
253 -84
260 -59
263 -39
266 -17
267 0
266 17
263 39
260 59
253 84
245 109
242 117
236 130
223 150
-207 -171
-180 -196
-155 -217
-140 -228
-111 -249
-94 -261
-72 -274
-55 -...

output:

1937.515999122596
2384.276161493165
2098.549192594300
3227.576473077826
2791.576659510562
806.146569821572
2736.170931270801
1120.138455007100
1564.039233168617
1072.977982354234
2034.109147296579
675.877515088977
1532.347009079179
1152.965143178176
556.634031794806
1146.056409476035
748.66465001603...

result:

ok 10000 numbers

Test #26:

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

input:

1000
815
0 -9983
75 -9981
111 -9980
134 -9979
230 -9974
308 -9969
370 -9964
453 -9957
548 -9945
632 -9934
715 -9923
749 -9918
837 -9905
892 -9896
959 -9885
1030 -9873
1053 -9869
1098 -9861
1193 -9844
1220 -9839
1241 -9835
1309 -9822
1397 -9805
1476 -9787
1570 -9764
1669 -9739
1700 -9731
1750 -9718
1...

output:

100591.939567512294
38481.905733447114
66436.249086716445
67739.823799330014
30418.901119186914
11512.081992937414
61802.582616315136
114011.890487663870
29355.269299813441
24826.321453865181
123918.884358646566
68590.684001389251
51101.105421531458
33094.699692125170
59106.173281492171
36901.595346...

result:

ok 1000 numbers

Test #27:

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

input:

100
4139
0 -312910
291 -312909
575 -312908
787 -312907
963 -312906
1248 -312904
1380 -312903
1631 -312901
1734 -312900
2029 -312897
2316 -312894
2475 -312892
2549 -312891
2834 -312887
2904 -312886
2969 -312885
3148 -312882
3411 -312877
3706 -312871
3901 -312867
4135 -312862
4344 -312857
4612 -312850...

output:

2161556.327707002871
3704618.236673816573
2417962.679176248144
166758.223879057972
1071878.081241394393
265868.509010590846
2036527.340805905871
3348132.170881610364
2177801.745045013726
257047.502150936518
1049629.858967710054
565674.838929987513
867475.961709182593
227933.605894821958
623724.46438...

result:

ok 100 numbers

Test #28:

score: 0
Accepted
time: 240ms
memory: 103088kb

input:

10
82723
0 -3104553
299 -3104552
597 -3104551
892 -3104550
1186 -3104549
1475 -3104548
1761 -3104547
2044 -3104546
2324 -3104545
2598 -3104544
2871 -3104543
3142 -3104542
3412 -3104541
3674 -3104540
3934 -3104539
4193 -3104538
4451 -3104537
4708 -3104536
4964 -3104535
5218 -3104534
5471 -3104533
572...

output:

31366897.846497111022
28364535.014438264072
23079154.302509561181
18245425.735387213528
33441956.664949752390
27695557.833168871701
20340144.492827698588
25553780.955342091620
37129110.422996103764
30518388.614918511361

result:

ok 10 numbers

Test #29:

score: 0
Accepted
time: 402ms
memory: 241532kb

input:

2
499999
0 -62423282
1000 -62423281
1995 -62423280
2988 -62423279
3976 -62423278
4962 -62423277
5946 -62423276
6925 -62423275
7892 -62423274
8850 -62423273
9804 -62423272
10757 -62423271
11707 -62423270
12652 -62423269
13589 -62423268
14525 -62423267
15458 -62423266
16388 -62423265
17315 -62423264
1...

output:

631860469.764303207397
440003898.228498458862

result:

ok 2 numbers

Test #30:

score: 0
Accepted
time: 400ms
memory: 233464kb

input:

2
249999
0 -125090809
1993 -125090808
3984 -125090807
5949 -125090806
7892 -125090805
9828 -125090804
11745 -125090803
13628 -125090802
15504 -125090801
17354 -125090800
19175 -125090799
20974 -125090798
22750 -125090797
24462 -125090796
26170 -125090795
27874 -125090794
29573 -125090793
31251 -1250...

output:

872872776.551129460335
1265323648.258651733398

result:

ok 2 numbers