QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#356877#6436. Paimon PolygonPorNPtreeTL 1983ms18488kbC++145.9kb2024-03-18 14:52:392024-03-18 14:52:39

Judging History

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

  • [2024-03-18 14:52:39]
  • 评测
  • 测评结果:TL
  • 用时:1983ms
  • 内存:18488kb
  • [2024-03-18 14:52:39]
  • 提交

answer

#include <bits/stdc++.h>
#define eps 1e-10

using namespace std;

const int N = 5e5 + 5;

inline pair<int, int> operator - (pair<int, int> x, pair<int, int> y)
{
    return make_pair(x.first - y.first, x.second - y.second);
}

inline long long operator * (pair<int, int> x, pair<int, int> y)
{
    return 1ll * x.first * y.second - 1ll * x.second * y.first;
}

inline double atan3(int y, int x)
{
    double f = atan2(y, x);
    return (f > -eps ? f : f + 2 * acos(-1.0));
}

int cs;

inline int cmp(pair<int, int> x, pair<int, int> y)
{
    double t1 = atan3(x.second, x.first) - atan3(y.second, y.first);
    return (fabs(t1) > eps ? t1 < 0 : ((hypot(x.first, x.second) < hypot(y.first, y.second)) ^ cs));
}

pair<int, int> jz;

inline int cmp2(pair<int, int> x, pair<int, int> y)
{
    return cmp(x - jz, y - jz);
}

int flag, S[N], top, vis[N];

pair< vector< pair<int, int> >, vector< pair<int, int> > > convex(vector< pair<int, int> > z)
{
    for (int i = 1; i < (int)z.size(); ++i) {
        if (z[i].second < z[0].second || (z[i].second == z[0].second && z[i].first < z[0].first)) {
            swap(z[0], z[i]);
        }
    }
    jz = z[0];
    sort(z.begin() + 1, z.end(), cmp2);
    S[top = 1] = 0;
    for (int i = 1; i < (int)z.size(); ++i) {
        while (top >= 2 && (z[S[top]] - z[S[top - 1]]) * (z[i] - z[S[top]]) < 0) {
            --top;
        }
        S[++top] = i;
    }
    for (int i = 0; i < (int)z.size(); ++i) {
        vis[i] = 0;
    }
    if (top <= 2) {
        flag = 0;
        return {{}, {}};
    }
    vector< pair<int, int> > S1, S2;
    for (int i = 1; i <= top; ++i) {
        S1.push_back(z[S[i]]);
        vis[S[i]] = 1;
        if ((z[S[i]] - z[S[(i == 1 ? top : i - 1)]]) * (z[S[(i == 1 ? top : i - 1)]] - z[S[(i == 1 ? top - 1 : (i == 2 ? top : i - 2))]]) == 0) {
            flag = 0;
            return {{}, {}};
        }
    }
    for (int i = 0; i < (int)z.size(); ++i) {
        if (!vis[i]) {
            S2.push_back(z[i]);
        }
    }
    return make_pair(S1, S2);
}

pair< vector< pair<int, int> >, vector< pair<int, int> > > convexHull(vector< pair<int, int> > z)
{
    cs = 0;
    pair< vector< pair<int, int> >, vector< pair<int, int> > > res1 = convex(z);
    if (!flag) {
        return {{}, {}};
    }
    cs = 1;
    pair< vector< pair<int, int> >, vector< pair<int, int> > > res2 = convex(z);
    if (!flag) {
        return {{}, {}};
    }
    return res1;
}

long double jerry(vector< pair<int, int> > z)
{
    long double res = 0;
    for (int i = 0; i < (int)z.size(); ++i) {
        int j = (i + 1 == (int)z.size() ? 0 : i + 1);
        res += hypot(z[i].first - z[j].first, z[i].second - z[j].second);
    }
    return res;
}

signed main()
{
    int T;
    scanf("%d", &T);
    for (int test = 1; test <= T; ++test) {
        int n;
        scanf("%d", &n);
        vector< pair<int, int> > z;
        for (int i = 1, x, y; i <= n; ++i) {
            scanf("%d%d", &x, &y);
            z.emplace_back(x, y);
        }
        flag = 1;
        z.emplace_back(0, 0);
        pair< vector< pair<int, int> >, vector< pair<int, int> > > tmp = convexHull(z);
        long double res = 0;
        if (flag) {
            vector< pair<int, int> > p1 = tmp.first, p2 = tmp.second, p3;
            int hv = 0;
            for (int i = 0; i < (int)p1.size(); ++i) {
                hv |= (p1[i] == make_pair(0, 0));
            }
            if (hv) {
                p2.emplace_back(0, 0);
                if ((int)p2.size() >= 3) {
                    tmp = convexHull(p2);
                    p2 = tmp.first, p3 = tmp.second;
                    if (flag && p3.empty()) {
                        res = max(res, jerry(p1) + jerry(p2));
                    }
                }
            }
        }
        z.pop_back();
        sort(z.begin(), z.end(), cmp);
        vector<int> hv;
        for (int i = 0; i < (int)z.size(); ++i) {
            if ((z[i] - z[(i + n - 1) % n]) * (z[(i + 1) % n] - z[i]) <= 0) {
                hv.push_back(i);
            }
        }
        if ((int)hv.size() > 4) {
            printf("%.10Lf\n", res);
            continue;
        }
        int ok = 1;
        for (int i = 0; i < (int)z.size(); ++i) {
            int j = (i + 1) % n;
            if (z[i] * z[j] == 0 && ((z[i].first != 0 && z[j].first != 0 && (z[i].first > 0) == (z[j].first > 0)) || (z[i].first == 0 && z[j].first == 0 && (z[i].second > 0) == (z[j].second > 0)))) {
                ok = 0;
                break;
            }
        }
        if (!ok) {
            printf("%.10Lf\n", res);
            continue;
        }
        long double ts = jerry(z);
        for (int i = 0, j = 1; i < (int)z.size(); ++i) {
            while ((j + 1) % n != i && (make_pair(0, 0) - z[i]) * z[(j + 1) % n] <= 0) {
                j = (j + 1) % n;
            }
            if ((make_pair(0, 0) - z[i]) * z[(j + 1) % n] == 0 || (make_pair(0, 0) - z[j]) * z[(i + 1) % n] == 0) {
                continue;
            }
            int ok = 1;
            for (auto x : hv) {
                if (x != i && x != j && x != (i + 1) % n && x != (j + 1) % n) {
                    ok = 0;
                    break;
                }
            }
            if (ok) {
                res = max(res, ts + hypot(z[i].first, z[i].second)
                                  + hypot(z[(i + 1) % n].first, z[(i + 1) % n].second)
                                  + hypot(z[j].first, z[j].second)
                                  + hypot(z[(j + 1) % n].first, z[(j + 1) % n].second)
                                  - hypot(z[i].first - z[(i + 1) % n].first, z[i].second - z[(i + 1) % n].second)
                                  - hypot(z[j].first - z[(j + 1) % n].first, z[j].second - z[(j + 1) % n].second));
            }
        }
        printf("%.10Lf\n", res);
    }
    return 0;
}

詳細信息

Test #1:

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

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.2111025509
36.6326947621
0.0000000000

result:

ok 3 numbers

Test #2:

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

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.3245553203
0.0000000000
30.6896447944
18.7482240257
30.2540122179
27.8210682918
36.6326947621
33.4097258671
29.5562146354
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000

result:

ok 14 numbers

Test #3:

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

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.1141680517
24824262.6835847613
359.1097585858
3042924.9210867869
547.7541625009
62188.8862666670
34663049.5304524610
51604481.6979927905
2264792232.4113187790
69911.1777695327
6924993.0023835884
27901.9604859406
0.0000000000
68869955.9200051048
741423.3147931471
35164453.6311061991
671.8132617321...

result:

ok 100 numbers

Test #4:

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

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.8098366946
787989807.6659954209
0.0000000000
1990.2717756307
0.0000000000
56.6254303179
38028.2640999909
535.6659455590
235257.8675583731
180.9505138061
602881.3711287219
46.4849160494
4110.4659447832
7564262751.1217311323
46670198.1187152467
2588369380.2164813578
338944.2793992752
0.0000000000
4...

result:

ok 100 numbers

Test #5:

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

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.4991715059
189693.6987251514
500121.8889460589
0.0000000000
404174872.6039223243
0.0000000000
7627885.1724237993
19929200.3387993108
0.0000000000
383750556.9717312176
217740941.8789576385
54.0037867350
469600775.6014016531
5373804146.8582614660
3096896.5349608146
48655.4723474733
424091181.18...

result:

ok 100 numbers

Test #6:

score: 0
Accepted
time: 603ms
memory: 6320kb

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.2371347435
0.0000000000
0.0000000000
47255.5024139636
22167105.4928279229
26656.7768842985
6358960.5547562959
4832622736.3216429055
400102464.6059833895
23350.8099848297
61.4363536929
5471759482.6362100840
0.0000000000
365216943.6330449283
0.0000000000
459002454.2754567377
0.0000000000
46...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 569ms
memory: 6328kb

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.3762955717
609117.8930830882
2330879690.6565488209
0.0000000000
2229.1040782987
59330.5565134982
5485547315.9834530354
140956853.3342528716
1784480.6105346505
105097.1480596157
29148820.1964101058
588.1043555045
0.0000000000
67.3375562302
77628337.7013852547
439644887.7588026654
4384588715.63...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 616ms
memory: 6296kb

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.7171111795
33.4358494788
0.0000000000
439149979.0548635814
0.0000000000
1742.3491807765
3433559646.1630614698
384890.2314940639
762965398.3871618211
2653519784.9547590651
4087583.7736930689
64069.8175330926
4204972630.1248052716
200793907.9893556926
38.7483113234
175649267.6458558068
230.3153...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 648ms
memory: 6412kb

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.0000000000
0.0000000000
0.0000000000
1463971750.3916688915
0.0000000000
5926392251.2862053253
0.0000000000
638995324.5677650236
0.0000000000
0.0000000000
431.0064468427
0.0000000000
0.0000000000
0.0000000000
587573422.2857667236
0.0000000000
13473064.6081461324
0.0000000000
0.0000000000
3015062142...

result:

ok 10000 numbers

Test #10:

score: 0
Accepted
time: 669ms
memory: 6388kb

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.2772710873
0.0000000000
6570171297.2482720837
7077996985.1937933527
9410898397.3059082609
9489932941.5894286996
6163709528.8952395245
9671708845.1201781631
6634363179.9099829495
7087210213.9258233467
6070552363.7208613157
9404754486.2366550267
0.0000000000
6125490207.1253274754
768952776...

result:

ok 10000 numbers

Test #11:

score: 0
Accepted
time: 767ms
memory: 6356kb

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.3638476357
6062816628.6112540271
5282468120.9119820893
4916606482.2725166231
5851908848.8994078711
0.0000000000
5836142327.3531953171
0.0000000000
5891667483.0973619819
0.0000000000
0.0000000000
5573040287.4672146328
5683480737.5504441671
5879369771.3722479343
5850582900.2832176760
601162...

result:

ok 10000 numbers

Test #12:

score: 0
Accepted
time: 843ms
memory: 6512kb

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.0000000000
0.0000000000
0.0000000000
11879686.2077046103
460290.3739280327
0.0000000000
0.0000000000
2891421.5246347698
0.0000000000
6095598345.9148430005
0.0000000000
0.0000000000
0.0000000000
8802401426.0989725729
4697770.6229338167
63130411.8584807399
0.0000000000
0.0000000000
0.0000000000
0.00...

result:

ok 1000 numbers

Test #13:

score: 0
Accepted
time: 879ms
memory: 6492kb

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.3502973393
7138209250.7790813772
10281890387.3026644606
0.0000000000
0.0000000000
0.0000000000
10222717940.2225741819
10263109914.4443084048
0.0000000000
0.0000000000
10281528585.6233781297
7087477367.0544454996
7134047957.9179913942
9138781001.2233828977
0.0000000000
7132663259.133566450...

result:

ok 1000 numbers

Test #14:

score: 0
Accepted
time: 1058ms
memory: 6480kb

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.0000000000
0.0000000000
0.0000000000
0.0000000000
7207037940.1478503421
0.0000000000
0.0000000000
7666076521.1852342375
0.0000000000
7302977064.1206584498
7221131942.0506848842
7645676182.0171428118
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
7695593533.5031190217
7611552474.6...

result:

ok 1000 numbers

Test #15:

score: 0
Accepted
time: 1057ms
memory: 4576kb

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.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
71386189.5975644095
0.0000000000
0.0000000000
75401247.2669743779
0.0000000000
0.0000000000
0.0000000000
0.0000000000
71404303.6882434007
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
99678191.7324414356...

result:

ok 100 numbers

Test #16:

score: 0
Accepted
time: 1128ms
memory: 6536kb

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.9758605883
10280990546.4632157851
10280798418.8945411518
10281888221.2449492291
10280384358.6826814860
10281373658.5482715238
7139905346.5062184702
10279388822.3250304954
0.0000000000
10278460756.1903231852
10240416793.6807436412
0.0000000000
7140929577.7032184787
10277657058.3587122727
7...

result:

ok 100 numbers

Test #17:

score: 0
Accepted
time: 1345ms
memory: 4488kb

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.3428663239
6674026094.8479764517
6681416033.0524367569
6682682546.3770461772
0.0000000000
6682987238.4949553837
6681864808.0165564846
6682255842.8585359538
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
6671981158.0086938338
6677000429.6436336841
6676779610....

result:

ok 100 numbers

Test #18:

score: 0
Accepted
time: 625ms
memory: 8436kb

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.7983857621
6659220064.4499326702
0.0000000000
7141342168.3517698902
0.0000000000
6682227777.6097123465
10279237142.3096379265
0.0000000000
0.0000000000
0.0000000000

result:

ok 10 numbers

Test #19:

score: 0
Accepted
time: 581ms
memory: 8272kb

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.0980092045
8414153822.3518277341
10282636866.5449977145
10282721178.5943322070
7141450732.4348365460
7141399171.1322686421
0.0000000000
7141353594.1732840291
7141035278.3952108398
7141339757.7357670460

result:

ok 10 numbers

Test #20:

score: 0
Accepted
time: 788ms
memory: 8388kb

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.0000000000
7196637126.3433829267
7197071555.2639439669
7187682514.6121903802
7197620133.5754003902
7197448259.8515847842
7197489500.9231565017
7197121407.3985795896
0.0000000000
0.0000000000

result:

ok 10 numbers

Test #21:

score: 0
Accepted
time: 1304ms
memory: 17708kb

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.0000000000
0.0000000000

result:

ok 2 numbers

Test #22:

score: 0
Accepted
time: 1983ms
memory: 18488kb

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.0000000000
0.0000000000

result:

ok 2 numbers

Test #23:

score: 0
Accepted
time: 599ms
memory: 11548kb

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.0000000000
0.0000000000

result:

ok 2 numbers

Test #24:

score: 0
Accepted
time: 337ms
memory: 6292kb

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.5958864847
227.6971175135
105.9901970635
205.8054902756
110.6681739292
99.0770480989
145.5612574704
113.7739640603
120.0522513742
189.9002005437
154.4024014762
251.0740354905
246.7267896641
171.0228645575
132.6987869542
226.4891433554
164.6547526778
134.7456983451
113.9720786968
122.4175772556
1...

result:

ok 50000 numbers

Test #25:

score: 0
Accepted
time: 426ms
memory: 6276kb

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.5159991226
2384.2761614932
2098.5491925943
3227.5764730778
2791.5766595106
806.1465698216
2736.1709312708
1120.1384550071
1564.0392331686
1072.9779823542
2034.1091472966
675.8775150890
1532.3470090792
1152.9651431782
556.6340317948
1146.0564094760
748.6646500160
2005.8961977414
1934.0990600733
...

result:

ok 10000 numbers

Test #26:

score: 0
Accepted
time: 660ms
memory: 6624kb

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.9395675123
38481.9057334471
66436.2490867164
67739.8237993300
30418.9011191869
11512.0819929374
61802.5826163151
114011.8904876638
29355.2692998134
24826.3214538652
123918.8843586467
68590.6840013892
51101.1054215314
33094.6996921252
59106.1732814922
36901.5953465153
84077.4101488262
9374.585...

result:

ok 1000 numbers

Test #27:

score: 0
Accepted
time: 914ms
memory: 6560kb

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.3277070049
3704618.2366738126
2417962.6791762463
166758.2238790579
1071878.0812413945
265868.5090105906
2036527.3408059064
3348132.1708816181
2177801.7450450141
257047.5021509365
1049629.8589677106
565674.8389299874
867475.9617091826
227933.6058948218
623724.4643829437
2096284.4224424165
238...

result:

ok 100 numbers

Test #28:

score: -100
Time Limit Exceeded

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:


result: