QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#747705#6542. Optimal Quadratic FunctionCrysflyAC ✓6436ms7044kbC++142.2kb2024-11-14 17:56:452024-11-14 17:56:48

Judging History

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

  • [2024-11-14 17:56:48]
  • 评测
  • 测评结果:AC
  • 用时:6436ms
  • 内存:7044kb
  • [2024-11-14 17:56:45]
  • 提交

answer

#include <bits/stdc++.h>
#define FOR(i, l, r) for(int i = (l); i <= (r); i++)
#define ROF(i, r, l) for(int i = (r); i >= (l); i--)
#define ll long long
#define vi vector <int>
#define sz(a) ((int) (a).size())
#define fi first
#define se second
#define ld long double
using namespace std;
const int N = 1e5 + 10;
const ld phi = (1 + sqrtl(5.L)) / 2;
int n;
int x[N], y[N];
ld ydel[N];
ll sqx[N];
ld A, B, ans;
ld X;
ld calc2(ld a, ld b) {
    B = b;
    ld mx = -1. / 0., mn = 1. / 0.;
    FOR(i, 1, n) {
        ld v = ydel[i] - b * x[i];
        mx = max(mx, v), mn = min(mn, v);
    }
    ans = min(ans, (mx - mn));
    return (mx - mn);
}
ld calc1(ld a) {
    FOR(i, 1, n) ydel[i] = y[i] - a * sqx[i];
    A = a;
    ld l = -1e13, r = 1e13;
    ld m1 = (l * phi + r) / (phi + 1), m2 = (l + r * phi) / (phi + 1);
    ld v1 = calc2(a, m1), v2 = calc2(a, m2);
    FOR(i, 1, 120) {
        if(v1 < v2) {
            r = m2;
            m2 = m1, v2 = v1;
            m1 = (l * phi + r) / (phi + 1), v1 = calc2(a, m1);
        } else {
            l = m1;
            m1 = m2, v1 = v2;
            m2 = (l + r * phi) / (phi + 1), v2 = calc2(a, m2);
        }
    }
    return calc2(a, l);
}
ld calc() {
    ld l = -1e7 / X, r = 1e7 / X;
    ld m1 = (l * phi + r) / (phi + 1), m2 = (l + r * phi) / (phi + 1);
    ld v1 = calc1(m1), v2 = calc1(m2);
    FOR(i, 1, 90) {
        if(v1 < v2) {
            r = m2;
            m2 = m1, v2 = v1;
            m1 = (l * phi + r) / (phi + 1), v1 = calc1(m1);
        } else {
            l = m1;
            m1 = m2, v1 = v2;
            m2 = (l + r * phi) / (phi + 1), v2 = calc1(m2);
        }
    }
    return calc1(l);
}
int CT = 0;
void rmain() {
    ans = 1. / 0.;
    cin >> n;
    int mx = 2e6, my = 2e6;
    FOR(i, 1, n) cin >> x[i] >> y[i], mx = min(mx, x[i]), my = min(my, y[i]);
    X = 1;
    FOR(i, 1, n) x[i] -= mx, y[i] -= my, X = max(X, (ld)x[i]), sqx[i] = (ll)x[i] * x[i];
    calc();
    // cerr << fixed << setprecision(20) << A <<" " << B << endl;
    cout << fixed << setprecision(20) << ans * ans / 4 << "\n";
}
int main() {
    ios :: sync_with_stdio(0), cin.tie(0);
    int T;
    for(cin >> T; T--; ) rmain();
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 5864kb

input:

1
4
0 0
1 3
2 9
3 0

output:

5.06250000000035484332

result:

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

Test #2:

score: 0
Accepted
time: 464ms
memory: 3732kb

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.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000006
0.00000000000000000000
543160.12599647929010870939
121.00000000000000000000
0.83200618124361808468
412780.60717948213869021856
12.25000000000000000000
15750.25000000000072475359
118751.38008609961558192936
88...

result:

ok 60 numbers

Test #3:

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

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.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0...

result:

ok 1000 numbers

Test #4:

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

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.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0...

result:

ok 1000 numbers

Test #5:

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

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.00000000000000288345
0.00000000000000026717
0.00000000000000012760
0.00000000000004337800
0.00000000000000987274
0.00000000000000281922
0.00000000000000000076
0.00000000000000313491
0.00000000000001875869
0.00000000000000022711
0.00000000000000132726
0.00000000000000390014
0.00000000000000007063
0...

result:

ok 1000 numbers

Test #6:

score: 0
Accepted
time: 384ms
memory: 5880kb

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.00163525344167897262
0.44188889494043709084
0.09508756553803589956
3655702.65199883397076519032
769858.66586190797193012259
876.96441888072844489388
2.38337819401671411929
0.00331434049271179839
0.04607429155657240455
0.41408727350372868782
31534.75284392140429012841
0.01153331512511562795
1322109...

result:

ok 1000 numbers

Test #7:

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

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.21742381245365671738
24899.70303782258292457641
111166879.55659097273019142449
440.66804451080335275348
45502620.02647758898820029572
0.90816574758920041055
48119370.93838587050049682148
1331743.10736801525217742892
1145.04104677620049990150
11911.40909035595313270051
898995.93108190154055137100...

result:

ok 1000 numbers

Test #8:

score: 0
Accepted
time: 525ms
memory: 3920kb

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.80273081734776496887
4736213.54502950183086795732
325.27660587080697474072
11692527.61933183017026749440
61306.46709800513281862777
24947264304.33335813693702220917
492734951022.51550963521003723145
0.96534574715818660651
1913.49550835407180782166
385.47466665177500086403
6.4484451865240...

result:

ok 1000 numbers

Test #9:

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

input:

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

output:

0.00000000000012789769

result:

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

Test #10:

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

input:

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

output:

12656250000.00000002514570951462

result:

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

Test #11:

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

input:

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

output:

0.00000000000000000000

result:

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

Test #12:

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

input:

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

output:

0.00000000000000000000

result:

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

Test #13:

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

input:

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

output:

0.56250000000034106051

result:

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

Test #14:

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

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.06253701449476523067
3306.25333130443563334211
310806.56100136885564211298
30885837.13795320646022446454
62499875000.11155024915933609009
561097185.45986156607978045940
0.56306322040615254532
2770157895.50190633884631097317

result:

ok 8 numbers

Test #15:

score: 0
Accepted
time: 40ms
memory: 5956kb

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.23606179223861545324
81676587.16302724076376762241
15097.23997093951451287097
23.39551245190477531989
579359934.00642046000575646758
3853.66365018198876724043
50.38138299148487468659
2611489.36559102875708049396
131464690.06344584043836221099
2137.82004144201023576599
284.1439656010993237...

result:

ok 50 numbers

Test #16:

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

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.57398686131980457270
11176.34287664415505325621
1192.74475295345262360058
453187006.52340880624251440167
554031869.36381527263438329101
9.20615901922235788275
126.71316383372679580110
2.79122517194189201741
7790357819.29176268354058265686
13298746917.73612509388476610184
138873066385.78075738251...

result:

ok 500 numbers

Test #17:

score: 0
Accepted
time: 6235ms
memory: 6988kb

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.19588700588792562485
27.05518082525884539236

result:

ok 2 numbers

Test #18:

score: 0
Accepted
time: 3235ms
memory: 5928kb

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.65034898492740467191
24.85472589903247203104
12179361658.00895566865801811218
3766193.37667094099288078723
162530385978.94015157222747802734
12661609.46256784004253859166
4212.84536702439551891786
47746959069.06262193247675895691
38556717282.98718152940273284912
34153564.440889332177903270...

result:

ok 1000 numbers

Test #19:

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

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.23831559863901929930
3501.15726773814715921951
3851361410.71171908802352845669
2454734.15993974158459423052
5.03590527592419721177
82.76832156504616153092
284923642635.16847199201583862305
380786260.88722499131108634174
17.16756083683574869714
5682477627.39927408657968044281
4.4553163679572...

result:

ok 1000 numbers

Test #20:

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

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.03478846543566760374
1560980.92847006237047935429
135793682616.94785629957914352417
597586.35611767369886138113
2293035.64550295755134357023
29924753323.65232908539474010468
102.66938651317228640286
2001978.22519890772298367665
32.62907417939953061067
3.32209340325179164669
12200829391.2318...

result:

ok 666 numbers

Test #21:

score: 0
Accepted
time: 6322ms
memory: 5964kb

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.28338376535543829959
60833.54496200451468368442
30687521.12158346867545333225
409369199255.91063472628593444824
156645670.15861068041704129428
1133.02880963404026715136
1180.61452006416067117556
9652051207.43616383243352174759
1404312.11801675002493539068
116471.29528772284219684252
19045036...

result:

ok 500 numbers

Test #22:

score: 0
Accepted
time: 6319ms
memory: 5928kb

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.68299241064030979942
739007712.31354477372951805592
8062740.94384092670588870533
46895.72582027341353594352
6280.63715344218854319536
18764.81772384801439557123
4518783186.36364514473825693130
163.26627744571769189352
444006974975.43223673105239868164
43.54528076084312010474
8.723682095358903...

result:

ok 400 numbers

Test #23:

score: 0
Accepted
time: 6281ms
memory: 5884kb

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.62858951423629250144
5144056.83195896167035243707
1108984120.79847823199816048145
536.95727643187797556434
2.18149065394400448552
2855000.52149908504520681163
7.89507092373438226383
26330215618.18334612809121608734
70553.22264962586429248859
4296.46120488598377029632
158697.1646867015840030035...

result:

ok 333 numbers

Test #24:

score: 0
Accepted
time: 6255ms
memory: 5976kb

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.48172573896660431103
137.32361429539267813627
7.32176367701490896003
108838738.72785384263261221349
143181888199.55392101407051086426
180745.03098811207787832700
3757486297.45226693782024085522
49308496.07332056818268029019
3.42121022543723767896
3719.39504327658229687614
5468199288.92968358425...

result:

ok 285 numbers

Test #25:

score: 0
Accepted
time: 6268ms
memory: 5904kb

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.64127922642757073657
3841279.09011600553344578657
12.57928453088386988069
575705766647.10761773586273193359
1558427.69806889974870500737
103457223182.76528315991163253784
3.12444231404917099459
4899838959.09122596634551882744
787527992820.62996971607208251953
398.60038405766610652980
102710.607...

result:

ok 250 numbers

Test #26:

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

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.79779842384910186481
888649.48290203919805207988
2548.31298337150742017165
237569579369.79427604377269744873
24.76043237882702617927
1529.44361470211752007664
2001480394.49292146263178437948
7281629.92437930240612331545
50766.11100797672574103103
168430563771.42499832808971405029
806829.97750998...

result:

ok 222 numbers

Test #27:

score: 0
Accepted
time: 6272ms
memory: 3828kb

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.53724964888533577323
7.04996780505601986205
5671529.65158268329560087295
664528040183.42012739181518554688
85.12065126634306197473
7648180137.92756465263664722443
1992099913.64016979862935841084
44806.03168691980247828610
1741949577.06428599776700139046
3.19168236989264791871
59567996.3208...

result:

ok 200 numbers

Test #28:

score: 0
Accepted
time: 6212ms
memory: 6004kb

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.41747761693056339993
5708564220.38626352604478597641
173867306652.44597920775413513184
262985.12326390249671703714
430508202.91510392978671006858
84862534.91933575158327585086
880.52040520886802227318
45696595.62039585047386935912
315.42955490960286399349
305020763584.99138230085372924805
857.4...

result:

ok 20 numbers

Test #29:

score: 0
Accepted
time: 6212ms
memory: 6948kb

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.72759681462775915861
2762.70600855490949609994

result:

ok 2 numbers

Test #30:

score: 0
Accepted
time: 6252ms
memory: 5952kb

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.35983518409193493426
4.50043352068846497010
349576359429.36061131954193115234
56072644255.02427172288298606873
472464940.01523131108842790127
28.54554180598390948978
3126.60787073105656586058
16689736.81604513540332845878
48476275650.28221404179930686951
28360079.48082398025144357234
13621...

result:

ok 200 numbers

Test #31:

score: 0
Accepted
time: 6214ms
memory: 6168kb

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.84289702925946441425
75778.43055541847023448554
31472925652.56011282093822956085
5541071814.07781119970604777336
12531584794.79769048839807510376
5.03453559014463840034
79583249.17426980769232613966
263.57918605396307065725
2111504.01480671657964194310
9220669.67116070228075841442
8882473448.23...

result:

ok 20 numbers

Test #32:

score: 0
Accepted
time: 6211ms
memory: 6952kb

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.19588700588792562485
27.05518082525884539236

result:

ok 2 numbers

Test #33:

score: 0
Accepted
time: 6252ms
memory: 5896kb

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.32497633350430987775
692823.50041189878305658567
64.57637904652858471671
2231952899.81993562984280288219
63034407.12614397460129112005
3647385879.14102410292252898216
6.22485817249854702553
186588789039.76071508228778839111
110362170.28292672858515288681
159530.72073718207929005075
1266636...

result:

ok 200 numbers

Test #34:

score: 0
Accepted
time: 6212ms
memory: 4156kb

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.88256419518693896009
639149.96621803539079564871
242.82311046540360542634
59436543748.14149825274944305420
4270273352.01756251929327845573
67629.09300979134420117589
11.85246663793842848006
55864092542.09904177859425544739
640493117912.88991510868072509766
20.45404264192749925130
126703.7793248...

result:

ok 20 numbers

Test #35:

score: 0
Accepted
time: 6245ms
memory: 6960kb

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.86196652124635875225
1299086484.22788376128301024437

result:

ok 2 numbers

Test #36:

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

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.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0...

result:

ok 1000 numbers

Test #37:

score: 0
Accepted
time: 333ms
memory: 5980kb

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.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0.00000000000000000000
0...

result:

ok 1000 numbers

Test #38:

score: 0
Accepted
time: 353ms
memory: 5920kb

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.00000000000000181203
0.00000000000000671782
0.00000000000000154175
0.00000000000000585943
0.00000000000001075424
0.00000000000000191813
0.00000000000000008305
0.00000000000000718921
0.00000000000001906136
0.00000000000002063775
0.00000000000000100950
0.00000000000000777948
0.00000000000000198539
0...

result:

ok 1000 numbers

Test #39:

score: 0
Accepted
time: 381ms
memory: 5940kb

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.29204148054122924805
37531261813.46395099535584449768
8874485904.10196668095886707306
212493502985.63306254148483276367
7250999080.49819120950996875763
20488573849.82740149274468421936
23311394774.24823976494371891022
99807117862.62726390361785888672
23062617866.28715012967586517334
386...

result:

ok 1000 numbers

Test #40:

score: 0
Accepted
time: 407ms
memory: 3920kb

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.98397760093212127686
85161480852.09869112819433212280
364999857514.55573049187660217285
38193794255.50510878115892410278
442592874023.33717101812362670898
674011877106.74509811401367187500
248849198288.52645154297351837158
41402592568.80511814355850219727
143358726694.919924110174179077...

result:

ok 1000 numbers

Test #41:

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

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.54907472431659698486
444176313518.80167001485824584961
506247807424.81415444612503051758
354780679482.23673719167709350586
539970632520.33195883035659790039
249634350280.66726623475551605225
571102826159.95308482646942138672
94682708939.27592668682336807251
394956981248.9719479382038116...

result:

ok 1000 numbers

Test #42:

score: 0
Accepted
time: 3235ms
memory: 3892kb

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.96867859363555908203
908077635051.92273581027984619141
936028198571.49836206436157226562
949110704399.56551980972290039062
937906309420.73693931102752685547
952314657587.20841032266616821289
878145042402.47872489690780639648
936442232024.46945673227310180664
949072984456.907267928123474...

result:

ok 1000 numbers

Test #43:

score: 0
Accepted
time: 6234ms
memory: 6036kb

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.75586444139480590820
999524805668.71904081106185913086
999251785658.79186391830444335938
999071955797.30494397878646850586
999838447779.58262991905212402344
999794592809.83326697349548339844
999777663877.09097278118133544922
999731012368.99475586414337158203
999091893506.776507377624511...

result:

ok 20 numbers

Test #44:

score: 0
Accepted
time: 6244ms
memory: 7044kb

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.31836181879043579102
999942779320.98944139480590820312

result:

ok 2 numbers

Test #45:

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

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.55944281816482543945
999757756670.67611885070800781250
998942975304.87564593553543090820
999598229269.27764576673507690430
998849702270.91839408874511718750
999569489549.96069878339767456055
999823989390.88205689191818237305
998831139698.57792079448699951172
999198313197.867242753505706...

result:

ok 20 numbers

Test #46:

score: 0
Accepted
time: 6211ms
memory: 6952kb

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.97890448570251464844
999918261435.79732215404510498047

result:

ok 2 numbers

Test #47:

score: 0
Accepted
time: 6229ms
memory: 4140kb

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.69313752651214599609
998784608815.45447039604187011719
999198703255.50032407045364379883
998727089694.13282084465026855469
999060441264.59684860706329345703
999711967923.78726285696029663086
999867916998.18928796052932739258
998877073732.47586870193481445312
999220250945.062665045261383...

result:

ok 20 numbers

Test #48:

score: 0
Accepted
time: 6227ms
memory: 6992kb

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.59238231182098388672
999942316699.20427411794662475586

result:

ok 2 numbers