QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#713755#9581. 都市叠高shift#AC ✓103ms4052kbC++2012.1kb2024-11-05 20:27:502024-11-05 20:27:51

Judging History

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

  • [2024-11-05 20:27:51]
  • 评测
  • 测评结果:AC
  • 用时:103ms
  • 内存:4052kb
  • [2024-11-05 20:27:50]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;
using u64 = unsigned long long;

template<class T>
struct Point {
    T x;
    T y;
    Point(T x_ = 0, T y_ = 0) : x(x_), y(y_) {}
    
    template<class U>
    operator Point<U>() {
        return Point<U>(U(x), U(y));
    }
    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-() const {
        return Point(-x, -y);
    }
    friend Point operator+(Point a, Point b) {
        return a += b;
    }
    friend Point operator-(Point a, Point b) {
        return a -= b;
    }
    friend Point operator*(Point a, T b) {
        return a *= b;
    }
    friend Point operator*(T a, Point b) {
        return b *= a;
    }
    friend bool operator==(Point a, Point b) {
        return a.x == b.x && a.y == b.y;
    }
    friend std::istream &operator>>(std::istream &is, Point &p) {
        return is >> p.x >> p.y;
    }
    friend std::ostream &operator<<(std::ostream &os, Point p) {
        return os << "(" << p.x << ", " << p.y << ")";
    }
};

template<class T>
T dot(Point<T> a, Point<T> b) {
    return a.x * b.x + a.y * b.y;
}

template<class T>
T cross(Point<T> a, Point<T> b) {
    return a.x * b.y - a.y * b.x;
}

template<class T>
T square(Point<T> p) {
    return dot(p, p);
}

template<class T>
long double length(Point<T> p) {
    return std::sqrt(square(p));
}

long double length(Point<long double> p) {
    return std::sqrt(square(p));
}

// 极角排序
template<class T>
bool cmp(const Point<T> &i, const Point<T> &j) {
    if(sgn(i) != sgn(j)) {
        return sgn(i) == 1;
    } else {
        return cross(i, j) > 0;
    }
}

template<class T>
struct Line {
    Point<T> a;
    Point<T> b;
    Line(Point<T> a_ = Point<T>(), Point<T> b_ = Point<T>()) : a(a_), b(b_) {}
};

template<class T>
Point<T> rotate(Point<T> a) {
    return Point(-a.y, a.x);
}

template<class T>
int sgn(Point<T> a) {
    return a.y > 0 || (a.y == 0 && a.x > 0) ? 1 : -1;
}

// 点到直线距离
template<typename T>
T Point_to_Line(Point<T> x, Line<T> l) {
    auto v1 = l.b - l.a, v2 = x - l.a;
    return sqrt(cross(v1, v2) * cross(v1, v2) / dot(v1, v1));
}

template<class T>
bool pointOnLineLeft(Point<T> p, Line<T> l) {
    return cross(l.b - l.a, p - l.a) > 0;
}

template<class T>
Point<T> lineIntersection(Line<T> l1, Line<T> l2) {
    return l1.a + (l1.b - l1.a) * (cross(l2.b - l2.a, l1.a - l2.a) / cross(l2.b - l2.a, l1.a - l1.b));
}

template<class T>
bool pointOnSegment(Point<T> p, Line<T> l) {
    return cross(p - l.a, l.b - l.a) == 0 && std::min(l.a.x, l.b.x) <= p.x && p.x <= std::max(l.a.x, l.b.x)
    && std::min(l.a.y, l.b.y) <= p.y && p.y <= std::max(l.a.y, l.b.y);
}

template<class T>
bool pointInPolygon(Point<T> a, std::vector<Point<T>> p) {
    int n = p.size();
    for (int i = 0; i < n; i++) {
        if (pointOnSegment(a, Line(p[i], p[(i + 1) % n]))) {
            return true;
        }
    }
    
    int t = 0;
    for (int i = 0; i < n; i++) {
        auto u = p[i];
        auto v = p[(i + 1) % n];
        if (u.x < a.x && v.x >= a.x && pointOnLineLeft(a, Line(v, u))) {
            t ^= 1;
        }
        if (u.x >= a.x && v.x < a.x && pointOnLineLeft(a, Line(u, v))) {
            t ^= 1;
        }
    }
    
    return t == 1;
}

// 0 : not intersect
// 1 : strictly intersect
// 2 : overlap
// 3 : intersect at endpoint
template<class T>
std::tuple<int, Point<T>, Point<T>> segmentIntersection(Line<T> l1, Line<T> l2) {
    if (std::max(l1.a.x, l1.b.x) < std::min(l2.a.x, l2.b.x)) {
        return {0, Point<T>(), Point<T>()};
    }
    if (std::min(l1.a.x, l1.b.x) > std::max(l2.a.x, l2.b.x)) {
        return {0, Point<T>(), Point<T>()};
    }
    if (std::max(l1.a.y, l1.b.y) < std::min(l2.a.y, l2.b.y)) {
        return {0, Point<T>(), Point<T>()};
    }
    if (std::min(l1.a.y, l1.b.y) > std::max(l2.a.y, l2.b.y)) {
        return {0, Point<T>(), Point<T>()};
    }
    if (cross(l1.b - l1.a, l2.b - l2.a) == 0) {
        if (cross(l1.b - l1.a, l2.a - l1.a) != 0) {
            return {0, Point<T>(), Point<T>()};
        } else {
            auto maxx1 = std::max(l1.a.x, l1.b.x);
            auto minx1 = std::min(l1.a.x, l1.b.x);
            auto maxy1 = std::max(l1.a.y, l1.b.y);
            auto miny1 = std::min(l1.a.y, l1.b.y);
            auto maxx2 = std::max(l2.a.x, l2.b.x);
            auto minx2 = std::min(l2.a.x, l2.b.x);
            auto maxy2 = std::max(l2.a.y, l2.b.y);
            auto miny2 = std::min(l2.a.y, l2.b.y);
            Point<T> p1(std::max(minx1, minx2), std::max(miny1, miny2));
            Point<T> p2(std::min(maxx1, maxx2), std::min(maxy1, maxy2));
            if (!pointOnSegment(p1, l1)) {
                std::swap(p1.y, p2.y);
            }
            if (p1 == p2) {
                return {3, p1, p2};
            } else {
                return {2, p1, p2};
            }
        }
    }
    auto cp1 = cross(l2.a - l1.a, l2.b - l1.a);
    auto cp2 = cross(l2.a - l1.b, l2.b - l1.b);
    auto cp3 = cross(l1.a - l2.a, l1.b - l2.a);
    auto cp4 = cross(l1.a - l2.b, l1.b - l2.b);
    
    if ((cp1 > 0 && cp2 > 0) || (cp1 < 0 && cp2 < 0) || (cp3 > 0 && cp4 > 0) || (cp3 < 0 && cp4 < 0)) {
        return {0, Point<T>(), Point<T>()};
    }
    
    Point p = lineIntersection(l1, l2);
    if (cp1 != 0 && cp2 != 0 && cp3 != 0 && cp4 != 0) {
        return {1, p, p};
    } else {
        return {3, p, p};
    }
}

template<class T>
bool segmentInPolygon(Line<T> l, std::vector<Point<T>> p) {
    int n = p.size();
    if (!pointInPolygon(l.a, p)) {
        return false;
    }
    if (!pointInPolygon(l.b, p)) {
        return false;
    }
    for (int i = 0; i < n; i++) {
        auto u = p[i];
        auto v = p[(i + 1) % n];
        auto w = p[(i + 2) % n];
        auto [t, p1, p2] = segmentIntersection(l, Line(u, v));
        
        if (t == 1) {
            return false;
        }
        if (t == 0) {
            continue;
        }
        if (t == 2) {
            if (pointOnSegment(v, l) && v != l.a && v != l.b) {
                if (cross(v - u, w - v) > 0) {
                    return false;
                }
            }
        } else {
            if (p1 != u && p1 != v) {
                if (pointOnLineLeft(l.a, Line(v, u))
                    || pointOnLineLeft(l.b, Line(v, u))) {
                    return false;
                }
            } else if (p1 == v) {
                if (l.a == v) {
                    if (pointOnLineLeft(u, l)) {
                        if (pointOnLineLeft(w, l)
                            && pointOnLineLeft(w, Line(u, v))) {
                            return false;
                        }
                    } else {
                        if (pointOnLineLeft(w, l)
                            || pointOnLineLeft(w, Line(u, v))) {
                            return false;
                        }
                    }
                } else if (l.b == v) {
                    if (pointOnLineLeft(u, Line(l.b, l.a))) {
                        if (pointOnLineLeft(w, Line(l.b, l.a))
                            && pointOnLineLeft(w, Line(u, v))) {
                            return false;
                        }
                    } else {
                        if (pointOnLineLeft(w, Line(l.b, l.a))
                            || pointOnLineLeft(w, Line(u, v))) {
                            return false;
                        }
                    }
                } else {
                    if (pointOnLineLeft(u, l)) {
                        if (pointOnLineLeft(w, Line(l.b, l.a))
                            || pointOnLineLeft(w, Line(u, v))) {
                            return false;
                        }
                    } else {
                        if (pointOnLineLeft(w, l)
                            || pointOnLineLeft(w, Line(u, v))) {
                            return false;
                        }
                    }
                }
            }
        }
    }
    return true;
}

template<class T>
std::vector<Point<T>> hp(std::vector<Line<T>> lines) {
    std::sort(lines.begin(), lines.end(), [&](auto l1, auto l2) {
        auto d1 = l1.b - l1.a;
        auto d2 = l2.b - l2.a;
        
        if (sgn(d1) != sgn(d2)) {
            return sgn(d1) == 1;
        }
        
        return cross(d1, d2) > 0;
    });
    
    std::deque<Line<T>> ls;
    std::deque<Point<T>> ps;
    for (auto l : lines) {
        if (ls.empty()) {
            ls.push_back(l);
            continue;
        }
        
        while (!ps.empty() && !pointOnLineLeft(ps.back(), l)) {
            ps.pop_back();
            ls.pop_back();
        }
        
        while (!ps.empty() && !pointOnLineLeft(ps[0], l)) {
            ps.pop_front();
            ls.pop_front();
        }
        
        if (cross(l.b - l.a, ls.back().b - ls.back().a) == 0) {
            if (dot(l.b - l.a, ls.back().b - ls.back().a) > 0) {
                
                if (!pointOnLineLeft(ls.back().a, l)) {
                    assert(ls.size() == 1);
                    ls[0] = l;
                }
                continue;
            }
            return {};
        }
        
        ps.push_back(lineIntersection(ls.back(), l));
        ls.push_back(l);
    }
    
    while (!ps.empty() && !pointOnLineLeft(ps.back(), ls[0])) {
        ps.pop_back();
        ls.pop_back();
    }
    if (ls.size() <= 2) {
        return {};
    }
    ps.push_back(lineIntersection(ls[0], ls.back()));
    
    return std::vector(ps.begin(), ps.end());
}

template<typename T>
std::vector<Point<T>> getHull(std::vector<Point<T>> p) {
    std::vector<Point<T>> h, l;
    
    std::sort(p.begin(), p.end(), [&](auto a, auto b) {
        if (a.x != b.x) {
            return a.x < b.x;
        } else {
            return a.y < b.y;
        }
    });
    
    p.erase(std::unique(p.begin(), p.end()), p.end());
    if (p.size() <= 1) {
        return p;
    }
    
    for (auto a : p) {
        while (h.size() > 1 && cross(a - h.back(), a - h[h.size() - 2]) <= 0) {
            h.pop_back();
        }
        while (l.size() > 1 && cross(a - l.back(), a - l[l.size() - 2]) >= 0) {
            l.pop_back();
        }
        l.push_back(a);
        h.push_back(a);
    }
    
    l.pop_back();
    std::reverse(h.begin(), h.end());
    h.pop_back();
    l.insert(l.end(), h.begin(), h.end());
    return l;
}

template<typename T>
i64 r(std::vector<Point<T>> h) {
    if(h.size() <= 1) return 0;
    if(h.size() == 2) {
        return square(h[0] - h[1]);
    }

    auto area = [&](Point<T> &a, Point<T> &b, Point<T> &c) -> i64 {
        return cross(c - a, c - b);
    };
    
    T ans = 0;
    for(int i = 0, j = 1, n = h.size(); i < n; i ++) {
        ans = std::max({ans, square(h[j] - h[i]), square(h[j] - h[(i + 1) % n])});

        while(area(h[(j + 1) % n], h[i], h[(i + 1) % n]) >= area(h[j], h[i], h[(i + 1) % n])) {
            j = (j + 1) % n;
            ans = std::max({ans, square(h[j] - h[i]), square(h[j] - h[(i + 1) % n] )});
        }
    }
    return ans;
}

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

    std::vector<long double> dp(n);
    std::vector<Point<i64>> h(n);
    for(int i = 0; i < n; i ++ ) {
        std::cin >> h[i];
        
        for(int j = 1; j < i; j ++ ) {
            dp[j] = std::max(dp[j - 1], dp[j]);
        }
        for(int j = 0; j < i; j ++ ) {
            dp[i] = std::max(dp[i], (j ? dp[j - 1] : 0) + sqrtl(square(h[i] - h[j])));
        }
    }

    std::cout << std::fixed << std::setprecision(8) << *std::max_element(dp.begin(), dp.end()) << '\n';

}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int T = 1;
    // std::cin >> T;

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

    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

7
1 0
0 1
0 0
1 1
1 2
3 2
3 3

output:

5.65685425

result:

ok found '5.6568543', expected '5.6568542', error '0.0000000'

Test #2:

score: 0
Accepted
time: 90ms
memory: 4052kb

input:

4741
583042625 -288151442
901234470 -999760464
-974135773 -819820344
562644007 892707743
-120734580 -288167839
-14369253 88358276
-150949453 -39424771
-947214734 -826830020
578141361 443534304
-783950948 394211236
861595911 -751206580
570425640 624990919
484450011 -470115909
-417437663 22205205
-278...

output:

2798587991989.88467836

result:

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

Test #3:

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

input:

3213
522199909 514991717
-232609361 652684240
279847038 136749526
-736646400 628493330
-94229099 39044538
-309386930 -566589012
-743178071 977659303
331655367 709620221
819648050 -137222273
-483906372 -718154516
289043195 250752012
-411924666 177871816
398984540 805195900
703931330 342254199
-856530...

output:

1901931022047.77827215

result:

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

Test #4:

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

input:

968
-385563683 -522813287
209254780 602611305
-135909694 -189263722
-560221149 430227148
418701856 300906413
142373383 -917649276
-660279103 -422510383
250385700 -352334214
-985948308 243315304
799743397 -952922578
812232051 936938663
-90803222 792720350
-471673653 862670783
7848186 -382327569
92478...

output:

578491625641.75151944

result:

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

Test #5:

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

input:

953
-478762162 556782215
-449686486 216328565
-44170762 669873691
842648553 921608634
881686869 -879142568
-310705987 -181489994
830441179 -110797482
975426657 191561809
82154355 -747749350
119879969 -758174233
205946922 -841205703
891282338 -293121292
-291513482 -926248534
-259415843 314744581
3087...

output:

548515721178.32603878

result:

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

Test #6:

score: 0
Accepted
time: 58ms
memory: 3868kb

input:

3759
676737194 -980777589
217638142 6869120
-125418314 123963171
-204688896 541552947
561865563 -55462182
-80455900 430710337
340645278 -696579669
-661503371 -541055133
657844506 925334877
-489646017 70483090
-318494961 -564680191
-435702114 715003944
-923874337 999952827
58509157 -824102071
9650985...

output:

2206491871737.34994698

result:

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

Test #7:

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

input:

1756
-794562341 189757398
613043582 723208622
-995430439 -983183746
-535180678 -268843337
683710261 474028965
-174478855 -923623466
452080293 -168429630
-313866124 -797744543
-708963290 -458862788
-848064376 -580578604
-698772531 -480867166
-740904810 993663858
-257651595 -845175149
-899827563 -9812...

output:

1036498275809.24169606

result:

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

Test #8:

score: 0
Accepted
time: 3ms
memory: 3820kb

input:

787
-7090150 526856296
983585064 864606987
791966318 -932273401
790414531 -962590263
-298101553 -750297443
-864851403 961707825
-645715752 242258574
-483808865 31609614
63153566 875139392
718544175 497170780
300611334 -673086931
295953448 -659892820
-332147467 -908330117
604437152 -278539108
-177244...

output:

462688629311.46623150

result:

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

Test #9:

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

input:

76
511351388 148937608
-765051015 -436970176
723116524 762293974
290499914 -661458121
-191417042 623970973
960822261 485952766
447507820 400688682
982713215 -633842708
-563958099 -645550204
712420915 515241338
-472445700 615252228
-855194394 -847734315
676479200 -957203437
-929157866 -35201369
29763...

output:

47060424949.16040421

result:

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

Test #10:

score: 0
Accepted
time: 26ms
memory: 3908kb

input:

2509
429840249 87593961
-781144839 -367765668
-319100136 175507520
463740161 532062477
428212053 -868971808
61501828 -545909867
-519549565 -244091284
486389381 656285616
776861744 -111829692
-320014746 -596760388
-211217331 -796722466
-291157077 -954656509
-498870218 875167125
-956272747 745584318
-...

output:

1488779644671.21362114

result:

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

Test #11:

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

input:

4731
828324934 -115821941
675339843 -390622205
374490228 -604641993
85274428 -930782926
716769527 77537703
-574045032 741753635
112560584 -500472256
-157434361 641494473
-223609765 528249214
-321457473 -430476260
-2160243 867435391
669146114 -913381923
92191218 895944136
237650254 -912799227
-540384...

output:

2771456417007.10446024

result:

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

Test #12:

score: 0
Accepted
time: 32ms
memory: 3944kb

input:

2760
931337814 119511454
-683347917 427882185
-845680099 875219814
910511178 497271414
-833608505 482037885
229853403 577013667
-967753092 772130182
-905618087 -641860421
-198207627 653599444
111134339 979416572
48472787 -645149240
326126778 85163773
-975853866 -895943279
862569427 478859966
7644324...

output:

1641981837161.23673940

result:

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

Test #13:

score: 0
Accepted
time: 66ms
memory: 3912kb

input:

4003
983856092 962653762
-169717046 290127957
214476265 604057342
-116309577 -929446895
759766456 -655349372
-595770198 -900469809
-994470686 -679537359
-993120731 -838206636
617489925 728379838
-898230109 -131869360
855913649 333137607
-539802443 630567246
-675704464 -730433814
54881080 178614628
9...

output:

2391581010099.92110109

result:

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

Test #14:

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

input:

4920
458810846 768039107
-973153299 -975967643
620026181 105318199
-884989267 -935367768
-794733144 -816152705
852418155 -54565141
536602110 578446188
526335127 12333718
818975064 -742380096
-362961964 -480086991
718783650 -718763047
-123356688 -474099282
767340203 512795977
208913084 -64359025
-551...

output:

2909986192315.98920345

result:

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

Test #15:

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

input:

1046
-483174906 743758038
270841702 -357341440
301435128 -626986752
-250629309 -896040099
-519419913 576584022
745499607 -360035440
779733802 442199952
-189533140 122145670
-312698604 484253998
128579649 -136096115
-137667474 349635592
631315914 -626501353
-23143982 -877863376
724371001 328904162
-4...

output:

625073963650.68588114

result:

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

Test #16:

score: 0
Accepted
time: 12ms
memory: 3812kb

input:

1673
-58998695 -877506047
-550919131 355648990
56181074 263557853
879381988 162999407
-852744941 -400470924
419415386 755724169
-217894954 -590650944
536947380 380279126
942725019 -478245969
-295346374 735788196
81372161 33933949
-762951402 -640855171
378338763 440745243
-212678146 -652416425
686472...

output:

999411208969.86558706

result:

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

Test #17:

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

input:

5000
34688642 -851839419
395784949 -667081997
-155389155 -624068418
-758711821 119194510
-812775173 -992436155
-592596572 851861070
-179673992 974613003
520596304 -485749861
-265233646 -115838823
-222234500 -573799007
-887109945 608830643
-906910755 483106217
384264657 -597593284
476657007 940783
-9...

output:

2958177763313.77564955

result:

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

Test #18:

score: 0
Accepted
time: 99ms
memory: 3912kb

input:

5000
-492673762 -496405053
764822338 111401587
774345046 -588077735
-972693439 959995351
-573156496 -729349041
645305810 326664422
-561855978 -477016787
461011057 697257071
377733217 -416669921
-204150537 784674141
-642123788 695471214
801626277 -968584097
68483816 -329331824
982358552 945230774
818...

output:

2981535748184.39508152

result:

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

Test #19:

score: 0
Accepted
time: 102ms
memory: 3972kb

input:

5000
390029247 153996608
-918017777 838007668
-244043252 -257119758
813324945 390730779
-38570526 -761229221
-116791808 634492154
760994742 19475923
991360398 -119735998
-632455126 -665623518
-481033868 -394909798
140919454 -974798424
510163308 -715241704
-542264319 -61070363
-511939904 -353569028
-...

output:

2961773410701.62036324

result:

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

Test #20:

score: 0
Accepted
time: 99ms
memory: 3960kb

input:

5000
-432300451 509430974
-600857890 -140418957
442601156 -464218867
61286241 -768468380
201048150 -203174812
826143280 404262799
673780049 567846134
983652653 525213848
600446325 -671487323
-462949905 963563350
628995403 -888157854
218700340 -166932017
898865049 207191097
288728935 590720963
-50838...

output:

2959320564556.74286485

result:

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

Test #21:

score: 0
Accepted
time: 102ms
memory: 3988kb

input:

5000
450402558 -840167367
-231820501 586187125
-627664644 -428228185
142271917 367299755
735634121 59912302
64045662 469000739
291598063 -935661158
-780965301 -291779221
-409742018 -920440920
965199471 -216020590
-587961356 -801517283
465294457 -156679415
583084208 423575055
794430480 -759956341
-19...

output:

2944171196056.31131697

result:

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

Test #22:

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

input:

5000
-76959846 -779700294
380306679 -340361999
58979764 -392237502
-314799493 -201964817
-729779910 28032122
-454962165 -56195909
-142461426 -387290947
-493705752 891227711
823159433 778727982
983283434 899362766
-48007905 -471786920
173831488 391630272
-322631221 691836515
-699867976 236211152
-130...

output:

2940327848374.55694962

result:

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

Test #23:

score: 0
Accepted
time: 102ms
memory: 3980kb

input:

5000
805743163 -181176136
454376774 681211377
988713965 -599336611
-823748404 638836024
-490161233 586086531
782940218 251631822
-524643413 -133888029
-553290999 74234642
-533873706 529774386
-998632604 -332098675
735035338 -385146349
-412598775 350005371
-638412062 960097976
-194166431 -819498858
-...

output:

2966669430514.93663621

result:

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

Test #24:

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

input:

5000
-311553829 469225525
-933496047 -592182543
-29674334 -268378634
-985852520 -225395842
44424737 849173645
20842600 21402468
-906825400 657571974
-266031450 -742758427
455937953 228943287
724484066 783284681
-776888715 -593473073
-460971951 603347764
-954192903 -528550773
68445323 -170176161
2475...

output:

2988672312355.47525883

result:

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

Test #25:

score: 0
Accepted
time: 98ms
memory: 3992kb

input:

5000
866116474 824659891
-564458658 429390833
656970075 -232387951
505198569 910372293
579010708 817293465
963777688 86140408
416025321 616007597
-325616697 440248505
-311160598 -20010310
742568030 -101331964
-236935264 -506832502
-752434920 -848342550
435058963 -850223901
574146868 825991332
314947...

output:

2970856061325.55018139

result:

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

Test #26:

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

input:

5000
-196228170 -181402541
328251238 624722764
682518931 783857631
969228879 547715844
-149364638 823684584
833196798 -913952210
-554264004 62726516
426420047 664711179
986117749 -418659204
-692340474 725195722
206423874 963934566
-850621504 688322091
-92095128 -259681786
220754482 52318280
-1634237...

output:

2958713299148.45320082

result:

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

Test #27:

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

input:

1
127346 9458760

output:

0.00000000

result:

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

Test #28:

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

input:

2
438580 2370872
28759 -23894729

output:

26268798.01481678

result:

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

Test #29:

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

input:

1
-1000000000 -1000000000

output:

0.00000000

result:

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

Test #30:

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

input:

2
1000000000 1000000000
-1000000000 1000000000

output:

2000000000.00000000

result:

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

Test #31:

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

input:

3
0 0
1000000000 0
0 -1000000000

output:

1414213562.37309505

result:

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

Test #32:

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

input:

4
1000000000 -1000000000
-1000000000 1000000000
0 0
1 -1

output:

2828427126.16040366

result:

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

Test #33:

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

input:

5
-1000000000 -1000000000
1000000000 1000000000
-999999999 -1000000000
1000000000 999999999
-1000000000 -999999999

output:

5656854248.07816663

result:

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

Test #34:

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

input:

10
273241060 -360748081
471537720 -647375704
-621925837 -22138471
904859645 820290727
-957530763 778258426
-370148620 -907251774
-188377660 -769041435
-987499732 546366365
-383619133 527915296
979817147 -791689541

output:

7313810466.46497788

result:

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

Test #35:

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

input:

4999
1000000000 -1000000000
-1000000000 1000000000
1000000000 -999999999
-999999999 999999999
999999999 -1000000000
-1000000000 999999999
1000000000 -999999998
-999999998 999999998
999999999 -999999998
-999999999 1000000000
999999998 -999999997
-999999999 999999997
1000000000 -999999997
-999999998 1...

output:

7068239218923.48201656

result:

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

Test #36:

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

input:

5000
513113832 317022344
-195627208 -861058397
-701102409 683872039
-232916858 -895311518
-709902748 -699035285
-101259535 -574097202
-441586520 -975050457
-932883145 -160150630
942128621 -594109340
-995714416 343225158
836636759 -111350445
237289348 -92696394
-246927599 -109448224
-215232650 -15016...

output:

2931001916139.33365846

result:

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

Test #37:

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

input:

4
0 0
1 0
0 1
1 1

output:

2.00000000

result:

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

Extra Test:

score: 0
Extra Test Passed