QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#915302#7916. Jogging TourenzeAC ✓363ms137600kbC++207.6kb2025-02-26 00:01:512025-02-26 00:01:52

Judging History

This is the latest submission verdict.

  • [2025-02-26 00:01:52]
  • Judged
  • Verdict: AC
  • Time: 363ms
  • Memory: 137600kb
  • [2025-02-26 00:01:51]
  • Submitted

answer

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define pb push_back

const ld pi = 3.14159265358979323846;
const int mod = (int)1e9 + 7;
const ll INF = 1e18;

template<typename T>
T chmax(T a, T b) {
    return a > b ? a : b;
}

template<typename T>
T chmin(T a, T b) {
    return a > b ? b : a;
}

const int N = (int)2e5 + 1, M = N * 2;

template<typename T>
struct Point{
    T x, y;
    ld eps;

    Point() : x(0), y(0), eps(1e-9) {}
    Point(T x, T y) : x(x), y(y), eps(1e-9) {}

    void set_eps(T eps){
        this->eps = eps;
    }

    Point operator+ (const Point& b){
        return Point(x + b.x, y + b.y);
    }

    Point operator- (const Point& b){
        return Point(x - b.x, y - b.y);
    }

    Point operator- (){
        return Point(-x, -y);
    }

    Point operator* (T t) const{
        return Point(x * t, y * t);
    }

    Point operator/ (T t) const{
        return Point(x / t, y / t);
    }

    Point &operator+=(Point p) &{
        x += p.x;
        y += p.y;
        return *this;
    }

    Point &operator-=(Point p) &{
        x -= p.x;
        y -= p.y;
        return *this;
    }

    Point &operator*=(T v) &{
        x *= v;
        y *= v;
        return *this;
    }

    Point &operator/=(T v) &{
        x /= v;
        y /= v;
        return *this;
    }

    Point &operator=(const Point& b) &{
        x = b.x;
        y = b.y;
        return *this;
    }

    friend Point operator+ (const Point& a, const Point& b){
        return {a.x + b.x, a.y + b.y};
    }

    friend Point operator- (const Point& a, const Point& b){
        return {a.x - b.x, a.y - b.y};
    }

    friend bool operator==(Point a, Point b){
        return a.x == b.x && a.y == b.y;
    }

    int sign(T x){
        if(fabs(x) < eps){
            return 0;
        }
        if(x < 0){
            return -1;
        }
        return 1;
    }

    bool cmp(T x, T y){
        if(fabs(x - y) > eps){
            return 0;
        }
        return 1;
    }

    bool cmp(const Point& a, const Point& b){
        return cmp(a.x, b.x) && cmp(a.y, b.y);
    }

    T dot(const Point& a, const Point& b){
        return a.x * b.x + a.y * b.y;
    }

    T square(Point a){
        return dot(a, a);
    }

    T cross(const Point& a, const Point& b){
        return a.x * b.y - a.y * b.x;
    }

    T cross(const Point& a, const Point& b, const Point& p){
        return (b.x - a.x) * (p.y - a.y) - (b.y - a.y) * (p.x - a.x);
    }

    T get_len(const Point& a){
        return sqrt(dot(a, a));
    }

    T get_angle(const Point& a, const Point& b){
        return acos(dot(a, b) / get_len(a) / get_len(b));
    }

    T area(const Point& a, const Point& b, const Point& c){
        return cross(b - a, c - a);
    }

    Point rotate(const Point& a, T angle){ //两个点就 b - a (b按a转)
        T dx = a.x * cos(angle) + a.y * sin(angle); 
        T dy = -a.x * sin(angle) + a.y * cos(angle);
        return Point(dx, dy);
    }

    Point intersect(const Point& p, const Point& v, const Point& q, const Point& w){
        Point u = p - q;
        T t = cross(w, u) / cross(v, w);
        return p + v * t;
    }

    T point_dist(const Point& a, const Point& b){
        return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
    }

    T line_dist(const Point& a, const Point& b, const Point& p){
        Point u = b - a, v = p - a;
        return fabs(cross(u, v)) / get_len(u);
    }

    T get_slope(const Point& a, const Point& b){
        if(b.y == a.y) return INF;
        if(b.x == a.x) return 0;
        return (b.y - a.y) / (b.x - a.x);
    }

    T circle_intersect(const Point& p1, const Point& p2, const T r1, const T r2){
        ld d = sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y));

        if(d > r1 + r2 || d + chmin(r1, r2) <= chmax(r1, r2)){
            return 0;
        }
        else if(d == r1 + r2){
            return 1;
        }
        else{
            return 2;
        }
    }

    T seg_dist(const Point& a, const Point& b, const Point& p){
        if(a == b){
            return get_len(p - a);
        }
        Point u = b - a, v = p - a, w = p - b;

        if(sign(dot(u, v)) < 0){
            return get_len(v);
        }
        if(sign(dot(u, w)) > 0){
            return get_len(w);
        }
        return line_dist(a, b, p);
    }

    Point projection(const Point& a, const Point& b, const Point& p){
        Point v = b - a;
        return a + v * dot(v, p - a) / dot(v, v);
    }

    bool on_segment(const Point& a, const Point& b, const Point& p){
        bool u = sign(cross(p - a, p - b)) == 0;
        bool v = sign(dot(p - a, p - b)) <= 0;
        return u && v;
    }

    bool seg_intersection(const Point& a1, const Point& a2, const Point& b1, const Point& b2){
        T c1 = cross(a2 - a1, b1 - a1), c2 = cross(a2 - a1, b2 - a1);
        T c3 = cross(b2 - b1, a2 - b1), c4 = cross(b2 - b1, a1 - b1);
        return sign(c1) * sign(c2) <= 0 && sign(c3) * sign(c4) <= 0;
    }

    friend std::ostream &operator<<(ostream &os, Point p) {
        return os << "(" << p.x << ", " << p.y << ")";
    }
};

void solve(){  
    int n;
    cin >> n;

    vector<Point<ld>> a;

    for(int i = 0; i < n; i++){
        ld x, y;
        cin >> x >> y;
        a.pb({x, y});
    }

    vector<vector<vector<ld>>> f(1 << n, vector<vector<ld>>(n * n, vector<ld>(n, INF)));
    vector<pair<Point<ld>, Point<ld>>> line;
    Point<ld> pt;

    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            Point<ld> vec = a[i] - a[j];
            Point<ld> perp = {-vec.y, vec.x};
            line.pb({vec, perp});
        }
    }

    int m = line.size();
    ld qwq = INF, inf = 1e9;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            f[1 << i][j][i] = 0;
        }
    }

    for(int i = 0; i < 1 << n; i++){
        for(int j = 0; j < m; j++){
            for(int k = 0; k < n; k++){
                if(i >> k & 1){
                    int mask = i & ~(1 << k);
                    auto p1 = line[j].first, p2 = line[j].second;

                    for(int l = 0; l < n; l++){
                        if((i >> l & 1) && l != k){
                            Point<ld> dvf = a[l] + p1 * inf;
                            Point<ld> dvb = a[l] + p1 * -inf;
                            Point<ld> dpf = a[l] + p2 * inf;
                            Point<ld> dpb = a[l] + p2 * -inf;

                            Point<ld> proj1 = pt.projection(dvf, dvb, a[k]);
                            Point<ld> proj2 = pt.projection(dpf, dpb, a[k]);

                            ld d1 = pt.point_dist(proj1, a[l]) + pt.point_dist(proj1, a[k]);
                            ld d2 = pt.point_dist(proj2, a[l]) + pt.point_dist(proj2, a[k]);
                            f[i][j][k] = chmin(f[i][j][k], f[mask][j][l] + chmin(d1, d2));
                        }
                    }
                }
            }
        }
    }

    for(int i = 0; i < m; i++){
        for(int j = 0; j < n; j++){
            qwq = chmin(qwq, f[(1 << n) - 1][i][j]);
        }
    }
    cout << setprecision(20) << qwq << endl;
} 

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t = 1;
    // cin >> t;

    while(t--){
        solve();
    }

    return 0;
}  

详细

Test #1:

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

input:

3
0 1
1 2
3 0

output:

4.2426406871192851463

result:

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

Test #2:

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

input:

4
1 4
6 0
5 3
2 6

output:

11.156638751501907605

result:

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

Test #3:

score: 0
Accepted
time: 356ms
memory: 137600kb

input:

12
0 0
1000000 1000000
1000000 0
0 1000000
500000 0
500000 1000000
0 500000
1000000 500000
250000 250000
250000 750000
750000 250000
750000 750000

output:

4949747.4680468824326

result:

ok found '4949747.4680469', expected '4949747.4683058', error '0.0000000'

Test #4:

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

input:

12
500001 500000
500001 500001
500002 500001
500002 500002
500003 500002
500003 500003
500004 500003
500004 500004
500005 500004
500005 500005
500006 500005
500006 500006

output:

11

result:

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

Test #5:

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

input:

12
550000 500000
550000 550000
600000 550000
600000 600000
650000 600000
650000 650000
700000 650000
700000 700000
750000 700000
750000 750000
800000 750000
800000 800000

output:

550000

result:

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

Test #6:

score: 0
Accepted
time: 6ms
memory: 6400kb

input:

8
278212 792776
606731 148551
838562 642422
206606 720970
490169 867167
867254 505748
824701 671690
649948 164703

output:

1549478.1963876759661

result:

ok found '1549478.1963877', expected '1549478.1964744', error '0.0000000'

Test #7:

score: 0
Accepted
time: 360ms
memory: 137600kb

input:

12
711554 668522
799933 759541
618514 572703
629454 583969
784553 743701
688308 644581
671193 615834
713797 668145
785602 756310
819818 798322
665804 609218
653602 594235

output:

352852.77456836864778

result:

ok found '352852.7745684', expected '352852.7746119', error '0.0000000'

Test #8:

score: 0
Accepted
time: 358ms
memory: 137344kb

input:

12
530516 243189
733290 72252
472464 472546
464083 505660
651482 395466
721261 119776
541101 443380
566186 263726
730850 305404
504427 248095
268768 374451
448274 233882

output:

1404441.2679066934296

result:

ok found '1404441.2679067', expected '1404441.2680073', error '0.0000000'

Test #9:

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

input:

12
685942 510296
682791 362548
622916 504795
664949 360990
516137 348002
695581 363664
394131 414642
492612 331971
655439 583858
860728 411528
552887 281373
899739 378780

output:

1160127.6977535247647

result:

ok found '1160127.6977535', expected '1160127.6978792', error '0.0000000'

Test #10:

score: 0
Accepted
time: 360ms
memory: 137600kb

input:

12
671321 623090
808149 708553
762207 816934
507179 657642
510944 659994
878594 752554
672138 658709
634878 663122
538103 791598
563000 758545
834882 442655
714937 601890

output:

1255115.2042506270901

result:

ok found '1255115.2042506', expected '1255115.2043233', error '0.0000000'

Test #11:

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

input:

7
192572 368048
4869 388554
239063 400581
812279 470560
780716 741281
823653 518076
557419 482536

output:

1259323.421913048986

result:

ok found '1259323.4219130', expected '1259323.4219517', error '0.0000000'

Test #12:

score: 0
Accepted
time: 126ms
memory: 56064kb

input:

11
853864 896320
106408 593454
204771 459160
5079 127798
888756 338318
495774 500469
145744 944258
460195 356358
297159 139794
422403 270301
458718 161069

output:

3226054.5789405358971

result:

ok found '3226054.5789405', expected '3226054.5790693', error '0.0000000'

Test #13:

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

input:

6
810632 76352
243377 385541
388761 178059
230235 667452
93049 222018
38351 950071

output:

1892324.0290518134534

result:

ok found '1892324.0290518', expected '1892324.0290759', error '0.0000000'

Test #14:

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

input:

2
336554 506039
185457 470827

output:

155145.70040126796889

result:

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

Test #15:

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

input:

2
356809 558358
656554 187885

output:

476547.27861357051296

result:

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

Test #16:

score: 0
Accepted
time: 41ms
memory: 23808kb

input:

10
465031 718623
732809 636428
19395 494440
410592 215294
525737 105362
951270 98444
584773 449874
131298 856571
520267 209471
638631 939132

output:

3016163.4061101233958

result:

ok found '3016163.4061101', expected '3016163.4063334', error '0.0000000'

Test #17:

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

input:

5
705278 337992
753208 589847
680830 621516
300581 767195
877853 890592

output:

1382212.61617622207

result:

ok found '1382212.6161762', expected '1382212.6161871', error '0.0000000'

Test #18:

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

input:

6
389016 751942
124337 996314
700289 100561
952576 573149
69836 958607
91358 431503

output:

2262275.389087874875

result:

ok found '2262275.3890879', expected '2262275.3891680', error '0.0000000'

Test #19:

score: 0
Accepted
time: 41ms
memory: 23808kb

input:

10
408848 910714
317653 45436
831034 588590
612090 2727
488923 770989
334672 707768
534563 399148
432658 864664
657295 980235
866892 911292

output:

2624702.633539844609

result:

ok found '2624702.6335398', expected '2624702.6336395', error '0.0000000'

Test #20:

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

input:

6
940988 450643
878159 431892
196142 753879
428068 272704
778673 630670
124817 404338

output:

1745951.6273909884426

result:

ok found '1745951.6273910', expected '1745951.6275600', error '0.0000000'

Test #21:

score: 0
Accepted
time: 5ms
memory: 6528kb

input:

8
756171 157
250232 662690
638163 54813
601098 66293
261749 474907
338844 955031
78196 765582
900791 652531

output:

2392010.8394582389092

result:

ok found '2392010.8394582', expected '2392010.8395423', error '0.0000000'

Test #22:

score: 0
Accepted
time: 15ms
memory: 11008kb

input:

9
722362 817024
955489 962653
571718 773273
271279 782034
764793 420692
437611 154993
773710 747775
88823 914099
365572 788790

output:

2423686.6793593446755

result:

ok found '2423686.6793593', expected '2423686.6795186', error '0.0000000'

Test #23:

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

input:

6
502781 751423
803984 11010
455813 415664
972027 669881
720491 49539
490300 656180

output:

1577710.5452332529686

result:

ok found '1577710.5452333', expected '1577710.5453206', error '0.0000000'

Test #24:

score: 0
Accepted
time: 44ms
memory: 23808kb

input:

10
716831 742724
416098 899988
114665 861682
786614 798424
332224 416588
120646 357538
192455 375012
777628 893487
175104 422698
158087 194856

output:

1995582.8314459012245

result:

ok found '1995582.8314459', expected '1995582.8315076', error '0.0000000'

Test #25:

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

input:

5
263067 207088
482847 938873
605571 401636
151058 67580
228542 743655

output:

1568226.3508399510596

result:

ok found '1568226.3508400', expected '1568226.3509068', error '0.0000000'

Test #26:

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

input:

10
746070 132591
214224 791126
134913 722000
203391 227639
194100 780835
895101 396941
289587 214071
432770 652084
398242 436911
161693 112249

output:

2246832.3034916620227

result:

ok found '2246832.3034917', expected '2246832.3036900', error '0.0000000'

Test #27:

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

input:

6
101834 946158
81940 753866
153608 195239
530790 448639
384289 78529
342743 544451

output:

1548917.1836241952328

result:

ok found '1548917.1836242', expected '1548917.1836921', error '0.0000000'

Test #28:

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

input:

4
57602 830261
854144 750508
685206 933626
191695 767539

output:

1059152.8436103157446

result:

ok found '1059152.8436103', expected '1059152.8436475', error '0.0000000'

Test #29:

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

input:

12
978167 794299
860900 843774
270708 368616
977305 523805
144911 824932
955897 568286
653815 52056
635431 179203
484955 416043
591222 213993
730658 876503
175666 273335

output:

2778995.3548180189005

result:

ok found '2778995.3548180', expected '2778995.3551367', error '0.0000000'

Test #30:

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

input:

3
677318 735997
688848 563195
329105 738432

output:

533676.72967150667176

result:

ok found '533676.7296715', expected '533676.7296848', error '0.0000000'

Test #31:

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

input:

5
962340 239443
418884 935721
497268 991452
153915 756533
369990 218352

output:

1834857.7469196067121

result:

ok found '1834857.7469196', expected '1834857.7470261', error '0.0000000'

Test #32:

score: 0
Accepted
time: 356ms
memory: 137600kb

input:

12
499999 500000
499999 500001
499998 500001
499998 500002
499997 500002
499997 500003
499996 500003
499996 500004
499995 500004
499995 500005
499994 500005
499994 500006

output:

11

result:

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

Test #33:

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

input:

12
500001 500000
500001 499999
500002 499999
500002 499998
500003 499998
500003 499997
500004 499997
500004 499996
500005 499996
500005 499995
500006 499995
500006 499994

output:

11

result:

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

Test #34:

score: 0
Accepted
time: 355ms
memory: 137472kb

input:

12
499999 500000
499999 499999
499998 499999
499998 499998
499997 499998
499997 499997
499996 499997
499996 499996
499995 499996
499995 499995
499994 499995
499994 499994

output:

11

result:

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

Test #35:

score: 0
Accepted
time: 354ms
memory: 137344kb

input:

12
450000 500000
450000 550000
400000 550000
400000 600000
350000 600000
350000 650000
300000 650000
300000 700000
250000 700000
250000 750000
200000 750000
200000 800000

output:

550000

result:

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

Test #36:

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

input:

12
550000 500000
550000 450000
600000 450000
600000 400000
650000 400000
650000 350000
700000 350000
700000 300000
750000 300000
750000 250000
800000 250000
800000 200000

output:

550000

result:

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

Test #37:

score: 0
Accepted
time: 356ms
memory: 137600kb

input:

12
450000 500000
450000 450000
400000 450000
400000 400000
350000 400000
350000 350000
300000 350000
300000 300000
250000 300000
250000 250000
200000 250000
200000 200000

output:

550000

result:

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

Test #38:

score: 0
Accepted
time: 350ms
memory: 137600kb

input:

12
500000 500001
500000 500002
500000 500003
500000 500004
500000 500005
500000 500006
500000 500007
500000 500008
500000 500009
500000 500010
500000 500011
500000 500012

output:

11

result:

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

Test #39:

score: 0
Accepted
time: 355ms
memory: 137600kb

input:

12
500001 500000
500002 500000
500003 500000
500004 500000
500005 500000
500006 500000
500007 500000
500008 500000
500009 500000
500010 500000
500011 500000
500012 500000

output:

11

result:

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

Test #40:

score: 0
Accepted
time: 355ms
memory: 137344kb

input:

12
500000 505000
500000 510000
500000 515000
500000 520000
500000 525000
500000 530000
500000 535000
500000 540000
500000 545000
500000 550000
500000 555000
500000 560000

output:

55000

result:

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

Test #41:

score: 0
Accepted
time: 348ms
memory: 137600kb

input:

12
505000 500000
510000 500000
515000 500000
520000 500000
525000 500000
530000 500000
535000 500000
540000 500000
545000 500000
550000 500000
555000 500000
560000 500000

output:

55000

result:

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

Test #42:

score: 0
Accepted
time: 354ms
memory: 137600kb

input:

12
500123 500456
500246 500912
500369 501368
500492 501824
500615 502280
500738 502736
500861 503192
500984 503648
501107 504104
501230 504560
501353 505016
501476 505472

output:

5195.2733325591253246

result:

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

Test #43:

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

input:

10
421497 529721
438975 557636
416413 492308
419721 475481
579178 472127
490350 583384
536641 424479
481925 418029
419638 475753
437933 556512

output:

416362.92441855224817

result:

ok found '416362.9244186', expected '416362.9244464', error '0.0000000'

Test #44:

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

input:

2
694656 772579
647585 800681

output:

54821.541796998011829

result:

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

Test #45:

score: 0
Accepted
time: 15ms
memory: 11136kb

input:

9
895707 360551
821333 769769
493854 919514
881488 325366
123914 314018
427769 86705
563445 85265
899470 628274
182514 225714

output:

2149079.516852713625

result:

ok found '2149079.5168527', expected '2149079.5169551', error '0.0000000'

Test #46:

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

input:

6
494332 520399
500597 478837
510201 518552
482368 511719
487964 482583
506538 479863

output:

93267.493388015793201

result:

ok found '93267.4933880', expected '93267.4933910', error '0.0000000'

Test #47:

score: 0
Accepted
time: 14ms
memory: 11264kb

input:

9
337767 349277
652744 660332
416111 295061
358303 329826
457082 717245
531352 719213
282132 539635
697927 400692
720341 522069

output:

1268592.1020183252363

result:

ok found '1268592.1020183', expected '1268592.1020856', error '0.0000000'

Test #48:

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

input:

6
365434 617012
613945 362827
676962 522010
652905 408240
428506 336634
469628 675720

output:

876030.44365224368113

result:

ok found '876030.4436522', expected '876030.4436943', error '0.0000000'

Test #49:

score: 0
Accepted
time: 14ms
memory: 11008kb

input:

9
653695 475399
564588 358382
617557 602018
606090 613896
480935 345521
405794 376094
654349 520097
462017 349054
643413 560498

output:

569385.18875380346509

result:

ok found '569385.1887538', expected '569385.1887913', error '0.0000000'

Test #50:

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

input:

7
41287 326993
58415 287039
287344 941732
10568 471615
766131 88268
408053 18445
545491 988139

output:

2191697.4696612016139

result:

ok found '2191697.4696612', expected '2191697.4697616', error '0.0000000'

Test #51:

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

input:

7
320939 500423
475131 322674
676937 527503
511100 678717
350452 401519
673175 545534
325751 458764

output:

835775.34301521629402

result:

ok found '835775.3430152', expected '835775.3430727', error '0.0000000'

Test #52:

score: 0
Accepted
time: 14ms
memory: 11264kb

input:

9
720848 237342
623561 820150
442734 161645
686118 788311
209884 316709
830108 406236
173871 606785
644170 188587
182998 631426

output:

1920331.449522965546

result:

ok found '1920331.4495230', expected '1920331.4495955', error '0.0000000'

Test #53:

score: 0
Accepted
time: 363ms
memory: 137600kb

input:

12
418518 673253
436377 641857
438755 637677
393214 717735
406685 694054
448766 620077
465095 756369
321195 643564
553455 825636
399131 704660
507212 789385
565891 835384

output:

526828.4550733415935

result:

ok found '526828.4550733', expected '526828.4550820', error '0.0000000'

Test #54:

score: 0
Accepted
time: 354ms
memory: 137600kb

input:

12
732234 616548
664155 635739
746127 612631
690903 628199
717405 620728
604119 652663
570734 659081
467366 724957
633046 619370
555691 668667
505459 700680
567648 661048

output:

375600.50979095635233

result:

ok found '375600.5097910', expected '375600.5098444', error '0.0000000'

Test #55:

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

input:

12
691373 435071
402051 396144
402681 396229
556300 416898
563484 417864
594683 422062
675413 448522
788138 488286
593347 419575
539878 400714
566996 410279
503773 387978

output:

495682.08634697260655

result:

ok found '495682.0863470', expected '495682.0863567', error '0.0000000'

Test #56:

score: 0
Accepted
time: 354ms
memory: 137600kb

input:

12
308167 681577
516661 608690
366549 661167
405943 647396
379078 656787
633275 567924
647245 699948
479134 538411
640271 693248
561984 618022
625195 678760
608365 662589

output:

740053.26754157227953

result:

ok found '740053.2675416', expected '740053.2675785', error '0.0000000'

Test #57:

score: 0
Accepted
time: 359ms
memory: 137600kb

input:

12
735225 652437
622404 669581
609331 671568
721100 654583
673018 661890
464528 693571
538388 761842
493875 468909
517995 627640
500569 512963
505165 543209
545204 806697

output:

802198.72187712058388

result:

ok found '802198.7218771', expected '802198.7219178', error '0.0000000'

Test #58:

score: 0
Accepted
time: 356ms
memory: 137344kb

input:

12
457716 416337
389335 302808
346292 231346
426163 363951
366584 265037
407604 333139
438899 385266
252797 497360
295152 471849
367894 428034
429308 391043
477901 361775

output:

560508.89427777620176

result:

ok found '560508.8942778', expected '560508.8942941', error '0.0000000'

Test #59:

score: 0
Accepted
time: 355ms
memory: 137600kb

input:

12
234198 650896
348619 690200
494264 740231
240774 653155
401032 708204
268562 662700
302472 656880
273921 739997
367339 468042
260634 778679
277850 728560
301465 659813

output:

782215.83162754692694

result:

ok found '782215.8316275', expected '782215.8317506', error '0.0000000'

Test #60:

score: 0
Accepted
time: 361ms
memory: 137344kb

input:

12
572166 727941
602534 713160
788802 622501
766473 633369
663422 683525
578306 724953
708894 588783
763703 780521
752007 739605
761898 774206
722479 636306
733145 673620

output:

594332.59390964594286

result:

ok found '594332.5939096', expected '594332.5939256', error '0.0000000'

Test #61:

score: 0
Accepted
time: 363ms
memory: 137600kb

input:

12
372944 768413
455202 833699
287258 700407
267376 684628
309059 717710
441322 822683
237349 795293
264093 762778
415859 578264
240737 791174
292791 727887
398656 599179

output:

676292.2106631662312

result:

ok found '676292.2106632', expected '676292.2107179', error '0.0000000'

Test #62:

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

input:

12
519220 632615
294612 775594
373340 725478
553152 611014
550074 612974
389127 715428
479033 670563
522919 739772
414524 568835
551869 785424
522480 739079
601786 864143

output:

861036.76377379661392

result:

ok found '861036.7637738', expected '861036.7638017', error '0.0000000'

Test #63:

score: 0
Accepted
time: 361ms
memory: 137472kb

input:

12
507237 338662
547924 367018
592514 398095
533377 356880
382638 251823
377715 248392
534013 345362
418476 511077
462904 447354
424312 502707
577602 282842
398147 540236

output:

739804.58840761454064

result:

ok found '739804.5884076', expected '739804.5884193', error '0.0000000'

Test #64:

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

input:

12
312526 456377
323426 316778
323984 309629
314610 429685
334452 175546
314851 426600
534457 284855
569027 287555
510562 282989
568250 287494
322605 268311
233413 261345

output:

805784.97077064196509

result:

ok found '805784.9707706', expected '805784.9707798', error '0.0000000'

Test #65:

score: 0
Accepted
time: 359ms
memory: 137600kb

input:

12
238400 586310
328939 540608
291191 559662
507976 450234
561062 423437
318367 545944
306544 451536
312845 464018
341968 521712
237887 315520
338088 514027
318467 475156

output:

724977.27221262562341

result:

ok found '724977.2722126', expected '724977.2723312', error '0.0000000'

Test #66:

score: 0
Accepted
time: 358ms
memory: 137472kb

input:

12
631493 567139
645888 577019
529534 497157
642612 574771
582039 533195
737661 640010
622262 739872
764908 532045
722815 593372
573702 810621
639071 715383
573615 810748

output:

733537.96459963182826

result:

ok found '733537.9645996', expected '733537.9646175', error '0.0000000'

Test #67:

score: 0
Accepted
time: 352ms
memory: 137472kb

input:

12
693974 682214
729535 846969
684341 637580
677276 604850
675874 598355
722510 814423
893962 614280
623522 672652
715511 652797
652726 666348
797196 635166
717523 652363

output:

659435.82232214601811

result:

ok found '659435.8223221', expected '659435.8223425', error '0.0000000'

Test #68:

score: 0
Accepted
time: 361ms
memory: 137600kb

input:

12
755596 616206
812112 594251
682961 644424
630206 664919
751254 617893
687106 642814
781440 776282
738131 664802
695055 553922
708824 589362
737328 662737
707722 586526

output:

608191.74282808346464

result:

ok found '608191.7428281', expected '608191.7428820', error '0.0000000'

Test #69:

score: 0
Accepted
time: 354ms
memory: 137600kb

input:

12
742138 381253
720708 381607
718211 381648
501417 385232
759993 380957
584454 383860
748864 207439
564181 398332
748614 207698
639591 320387
638477 321538
624976 335493

output:

590791.91535575901071

result:

ok found '590791.9153558', expected '590791.9154247', error '0.0000000'

Test #70:

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

input:

12
301278 575013
336473 569235
461467 548716
513310 540205
313063 573079
443389 551684
504254 378840
380903 550646
459743 440837
409886 510278
393294 533388
478088 415286

output:

531629.74793526828165

result:

ok found '531629.7479353', expected '531629.7479992', error '0.0000000'

Test #71:

score: 0
Accepted
time: 354ms
memory: 137600kb

input:

12
541331 357060
538409 350276
527154 324145
542279 359261
470669 193000
526758 323226
491441 351590
331832 288081
544138 372559
531695 367608
638628 410156
504661 356851

output:

633828.25089638315421

result:

ok found '633828.2508964', expected '633828.2509358', error '0.0000000'

Test #72:

score: 0
Accepted
time: 358ms
memory: 137344kb

input:

12
524435 252263
496388 393576
465136 551035
529974 224357
467049 541394
515637 296591
498569 302329
538279 361705
444808 221942
591323 441020
510716 320491
525898 343193

output:

692892.20274509044941

result:

ok found '692892.2027451', expected '692892.2027850', error '0.0000000'

Test #73:

score: 0
Accepted
time: 352ms
memory: 137600kb

input:

12
614328 538012
624644 534217
743870 490358
665418 519217
797942 470466
754428 486473
669665 510346
708547 426208
738907 360513
738538 361310
685996 475008
633526 588549

output:

527892.30231745876836

result:

ok found '527892.3023175', expected '527892.3023317', error '0.0000000'

Test #74:

score: 0
Accepted
time: 355ms
memory: 137600kb

input:

12
401353 364977
113898 264510
339487 343355
256554 314369
365682 352510
110394 263285
361433 297153
76278 434609
316377 318872
373754 291213
338413 308249
400899 278128

output:

724302.07730710751241

result:

ok found '724302.0773071', expected '724302.0773466', error '0.0000000'

Test #75:

score: 0
Accepted
time: 356ms
memory: 137600kb

input:

12
681803 574939
672303 533476
665005 501629
707760 688219
705320 677568
696663 639787
847330 658817
691815 561324
882772 681036
750421 598064
646226 532744
638275 527760

output:

584213.09577803685335

result:

ok found '584213.0957780', expected '584213.0958336', error '0.0000000'

Test #76:

score: 0
Accepted
time: 354ms
memory: 137600kb

input:

12
536445 665297
537379 661927
569608 545584
633127 316285
593880 457965
535254 669596
595477 422883
702751 611597
660227 536790
581480 398260
640900 502791
666097 547116

output:

746206.69756067084546

result:

ok found '746206.6975607', expected '746206.6976131', error '0.0000000'

Test #77:

score: 0
Accepted
time: 359ms
memory: 137600kb

input:

12
579748 432108
539169 648618
601948 313658
536243 664228
537732 656283
577331 445005
604314 452978
557108 386514
590037 432876
553364 381244
697666 584411
698377 585413

output:

625488.5361821000547

result:

ok found '625488.5361821', expected '625488.5362665', error '0.0000000'

Test #78:

score: 0
Accepted
time: 355ms
memory: 137600kb

input:

12
527918 737105
533997 738643
562655 687242
857531 561446
439557 656095
572704 689785
460837 764686
416513 678993
420204 664407
616163 605710
654352 454782
632666 540489

output:

877105.42684067386256

result:

ok found '877105.4268407', expected '877105.4269623', error '0.0000000'

Test #79:

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

input:

12
412420 713073
511423 338689
448182 230781
353205 724446
681990 305929
524465 336184
752820 463969
749481 446585
581280 376267
721179 299239
724239 315169
566250 298011

output:

1227631.8175142837358

result:

ok found '1227631.8175143', expected '1227631.8176913', error '0.0000000'

Test #80:

score: 0
Accepted
time: 359ms
memory: 137472kb

input:

12
650284 572721
716482 566201
384567 532878
786404 775311
626173 550166
696386 691098
643108 480752
566916 646366
704316 415324
782706 400465
492797 530865
656600 355770

output:

1451631.7167270654461

result:

ok found '1451631.7167271', expected '1451631.7167594', error '0.0000000'

Test #81:

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

input:

12
519880 476262
593427 546310
393012 454264
514376 709681
393453 435568
517414 580823
328475 458121
344223 702104
616280 601861
744807 604891
614249 613705
464333 610170

output:

1223098.2799695027531

result:

ok found '1223098.2799695', expected '1223098.2800772', error '0.0000000'

Test #82:

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

input:

12
484245 539629
161265 422242
179758 460198
570891 717469
551877 678443
191714 484739
105574 684850
358040 842465
362649 840318
540341 757550
643551 709476
181041 649698

output:

1398668.9147692373471

result:

ok found '1398668.9147692', expected '1398668.9147841', error '0.0000000'

Test #83:

score: 0
Accepted
time: 359ms
memory: 137600kb

input:

12
756797 439548
207726 645386
551549 703970
155711 712397
225376 622647
741110 459758
696874 542500
703709 548000
253056 524216
456722 688080
773872 604451
385274 630594

output:

1204258.8283627043485

result:

ok found '1204258.8283627', expected '1204258.8284028', error '0.0000000'

Test #84:

score: 0
Accepted
time: 358ms
memory: 137600kb

input:

12
980942 734898
824330 703985
622961 664239
330426 426808
797079 472685
641375 441952
362735 426310
570493 339042
593831 656578
603530 611588
571527 334241
720798 782679

output:

1542393.2230357845029

result:

ok found '1542393.2230358', expected '1542393.2231617', error '0.0000000'

Test #85:

score: 0
Accepted
time: 352ms
memory: 137472kb

input:

12
766900 307395
373475 564777
478877 560196
652926 721357
499545 430565
371782 619393
662981 818218
560273 540870
559953 528555
696197 121492
658498 645665
384441 484700

output:

1467067.2954583520307

result:

ok found '1467067.2954584', expected '1467067.2955544', error '0.0000000'

Test #86:

score: 0
Accepted
time: 363ms
memory: 137600kb

input:

12
274462 289347
732196 525239
279644 310583
252122 507704
333848 535513
323144 539460
230738 572738
273324 659832
590689 431656
713196 404013
411316 628695
302184 247974

output:

1420047.7053428389144

result:

ok found '1420047.7053428', expected '1420047.7053935', error '0.0000000'

Test #87:

score: 0
Accepted
time: 359ms
memory: 137600kb

input:

12
252272 709637
363953 519661
557539 45733
337056 565414
408960 298472
517446 732018
573098 615571
388646 93312
601671 725665
562766 575766
415887 198269
449917 329385

output:

1657784.6054501144627

result:

ok found '1657784.6054501', expected '1657784.6055462', error '0.0000000'

Test #88:

score: 0
Accepted
time: 356ms
memory: 137600kb

input:

12
505514 585211
728262 658934
666754 311866
724445 450131
264777 423831
577615 282365
751410 654324
466491 523657
461295 526269
595066 732913
547228 483073
545340 757908

output:

1495427.405341924118

result:

ok found '1495427.4053419', expected '1495427.4054961', error '0.0000000'

Test #89:

score: 0
Accepted
time: 356ms
memory: 137600kb

input:

12
537593 307426
483428 605436
339117 549122
258596 447936
414142 401335
412866 330583
492510 487851
418473 533626
493697 479119
643739 633764
451206 292784
501099 424660

output:

1183671.2858123018715

result:

ok found '1183671.2858123', expected '1183671.2858397', error '0.0000000'

Test #90:

score: 0
Accepted
time: 354ms
memory: 137600kb

input:

12
608836 643869
648920 594585
452754 851928
488899 238759
608167 320407
562484 442096
507773 598252
676681 497127
681505 667635
496926 492878
503009 551976
675908 613264

output:

1419479.4656476242764

result:

ok found '1419479.4656476', expected '1419479.4656799', error '0.0000000'

Test #91:

score: 0
Accepted
time: 356ms
memory: 137600kb

input:

12
273430 706010
381022 544453
781074 348654
307507 654842
438089 458762
810875 303905
752751 291511
317469 699276
747798 368890
758718 198287
316904 708097
751459 311682

output:

1106621.188742425221

result:

ok found '1106621.1887424', expected '1106621.1890495', error '0.0000000'

Test #92:

score: 0
Accepted
time: 360ms
memory: 137600kb

input:

12
468550 541265
667932 296686
628169 439741
693094 486420
644077 517597
704910 273166
737792 459004
585504 350887
545633 427340
779504 379017
569783 381032
475497 561830

output:

939374.5526751740137

result:

ok found '939374.5526752', expected '939374.5527193', error '0.0000000'

Test #93:

score: 0
Accepted
time: 360ms
memory: 137600kb

input:

12
341999 396058
596483 658480
425696 340629
410195 343237
833116 618672
287823 363822
512379 250642
469022 336912
626195 631519
459115 294626
585468 240753
514815 248630

output:

1189878.4705133788175

result:

ok found '1189878.4705134', expected '1189878.4707559', error '0.0000000'

Test #94:

score: 0
Accepted
time: 360ms
memory: 137600kb

input:

12
574001 450955
527570 399121
500034 636342
256064 725964
237035 704722
402445 615593
251689 723498
763124 446181
747393 502149
531586 685709
461649 408495
692374 484116

output:

1224205.3254098766803

result:

ok found '1224205.3254099', expected '1224205.3254953', error '0.0000000'

Test #95:

score: 0
Accepted
time: 359ms
memory: 137472kb

input:

12
353268 531710
521237 686339
423804 573249
528727 675999
487082 485896
199535 597135
652695 328017
258420 538466
528884 638542
457997 550981
541608 515813
471532 420428

output:

1150971.0315455745097

result:

ok found '1150971.0315456', expected '1150971.0316021', error '0.0000000'

Test #96:

score: 0
Accepted
time: 356ms
memory: 137600kb

input:

12
535540 513343
186779 555933
579399 462402
715807 246252
623604 353345
179323 564594
420914 478308
604995 342954
686790 377095
323243 378125
603087 291239
580938 268521

output:

1196543.4690369320459

result:

ok found '1196543.4690369', expected '1196543.4691764', error '0.0000000'

Test #97:

score: 0
Accepted
time: 360ms
memory: 137472kb

input:

12
663038 372506
568121 182326
574592 503333
360125 342147
285299 350298
529061 469114
600227 519959
500807 402009
433249 535305
586080 535710
683824 426877
650498 413322

output:

1228236.1880879463019

result:

ok found '1228236.1880879', expected '1228236.1881489', error '0.0000000'

Test #98:

score: 0
Accepted
time: 350ms
memory: 137600kb

input:

12
432463 426338
332779 490444
503082 557294
359083 580577
500102 461886
467949 489646
515560 367329
227504 499256
446350 644859
263750 473864
375903 547206
363470 612096

output:

906208.76952717611812

result:

ok found '906208.7695272', expected '906208.7695492', error '0.0000000'

Test #99:

score: 0
Accepted
time: 360ms
memory: 137600kb

input:

12
519692 323632
664490 617537
258834 410515
678187 492478
624400 553376
406754 344350
336920 648536
657096 581036
461792 406870
385831 623616
231828 524037
427418 424383

output:

1306139.9566351962845

result:

ok found '1306139.9566352', expected '1306139.9567613', error '0.0000000'

Test #100:

score: 0
Accepted
time: 14ms
memory: 11136kb

input:

9
5 0
5 1
5 2
5 3
5 4
3 2
4 2
6 2
7 2

output:

11.999999999534338713

result:

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

Test #101:

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

input:

3
218526 516531
78726 616462
271908 262284

output:

502598.36571022571695

result:

ok found '502598.3657102', expected '502598.3657113', error '0.0000000'

Test #102:

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

input:

3
719469 692553
574141 782394
320480 730251

output:

500489.76123553206156

result:

ok found '500489.7612355', expected '500489.7612448', error '0.0000000'

Test #103:

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

input:

3
285071 201200
361047 793804
676205 976434

output:

1108054.2282201141908

result:

ok found '1108054.2282201', expected '1108054.2283093', error '0.0000000'

Test #104:

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

input:

3
150435 744155
438336 925272
974137 748377

output:

1043097.3255959635366

result:

ok found '1043097.3255960', expected '1043097.3256297', error '0.0000000'

Test #105:

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

input:

2
0 0
0 1

output:

1

result:

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

Test #106:

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

input:

2
4 5
5 4

output:

1.4142135623730950488

result:

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

Test #107:

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

input:

2
4 4
5 6

output:

2.2360679774997896964

result:

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

Test #108:

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

input:

3
0 0
5 5
0 10

output:

14.142135623730950488

result:

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

Test #109:

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

input:

3
1 0
10 1
9 10

output:

18.110770276274833252

result:

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

Test #110:

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

input:

4
1 0
10 1
9 10
0 9

output:

27.166155414412249878

result:

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

Test #111:

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

input:

4
1 0
10 2
9 10
0 9

output:

26.282703205247816974

result:

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

Test #112:

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

input:

3
1 0
10 2
9 10

output:

18.005227998493889753

result:

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

Test #113:

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

input:

3
1 0
10 1
10 10

output:

18.99422248435936874

result:

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