QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#722503#9547. Two Convex Holesucup-team004AC ✓513ms7884kbC++2321.3kb2024-11-07 19:16:272024-11-07 19:16:28

Judging History

This is the latest submission verdict.

  • [2024-11-07 19:16:28]
  • Judged
  • Verdict: AC
  • Time: 513ms
  • Memory: 7884kb
  • [2024-11-07 19:16:27]
  • Submitted

answer

#include <bits/stdc++.h>

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;

using F = __float128;
std::istream &operator>>(std::istream &is, F &a) {
    int x;
    is >> x;
    a = x;
    return is;
}
std::ostream &operator<<(std::ostream &is, F a) {
    return is << double(a);
}

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

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

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

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

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

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

template<class T>
double length(const Line<T> &l) {
    return length(l.a - l.b);
}

template<class T>
Point<T> normalize(const Point<T> &p) {
    return p / length(p);
}

template<class T>
bool parallel(const Line<T> &l1, const Line<T> &l2) {
    return cross(l1.b - l1.a, l2.b - l2.a) == 0;
}

template<class T>
double distance(const Point<T> &a, const Point<T> &b) {
    return length(a - b);
}

template<class T>
double distancePL(const Point<T> &p, const Line<T> &l) {
    return std::abs(cross(l.a - l.b, l.a - p)) / length(l);
}

template<class T>
double distancePS(const Point<T> &p, const Line<T> &l) {
    if (dot(p - l.a, l.b - l.a) < 0) {
        return distance(p, l.a);
    }
    if (dot(p - l.b, l.a - l.b) < 0) {
        return distance(p, l.b);
    }
    return distancePL(p, l);
}

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

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

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

template<class T>
Point<T> lineIntersection(const Line<T> &l1, const 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(const Point<T> &p, const 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(const Point<T> &a, const 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(const Line<T> &l1, const 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>
double distanceSS(const Line<T> &l1, const Line<T> &l2) {
    if (std::get<0>(segmentIntersection(l1, l2)) != 0) {
        return 0.0;
    }
    return std::min({distancePS(l1.a, l2), distancePS(l1.b, l2), distancePS(l2.a, l1), distancePS(l2.b, l1)});
}

template<class T>
bool segmentInPolygon(const Line<T> &l, const 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());
}

using Pt = Point<F>;
using C = std::complex<F>;

constexpr F eps = 1E-10;

void solve() {
    Pt o;
    F zo;
    Pt v;
    
    std::cin >> o >> zo >> v;
    
    int n1;
    F z1;
    std::cin >> n1 >> z1;
    
    std::vector<Pt> a(n1);
    for (int i = 0; i < n1; i++) {
        std::cin >> a[i];
        a[i] -= o;
    }
    
    int n2;
    F z2;
    std::cin >> n2 >> z2;
    
    std::vector<Pt> b(n2);
    for (int i = 0; i < n2; i++) {
        std::cin >> b[i];
        b[i] -= o;
    }
    for (int i = 0; i < n1; i++) {
        a[i] *= zo - z2;
    }
    for (int i = 0; i < n2; i++) {
        b[i] *= zo - z1;
    }
    
    v *= (z2 - z1);
    
    F mul = 1;
    {
        mul = dot(v, v);
        C rot = C(0, 1) / C(v.x, v.y);
        for (int i = 0; i < n1; i++) {
            auto c = C(a[i].x, a[i].y) * rot;
            a[i] = Pt(c.real(), c.imag());
        }
        for (int i = 0; i < n2; i++) {
            auto c = C(b[i].x, b[i].y) * rot;
            b[i] = Pt(c.real(), c.imag());
        }
    }
    mul /= 2;
    mul *= zo / (zo - z1) / (zo - z2);
    mul *= zo / (zo - z1) / (zo - z2);
    
    // for (int i = 0; i < n1; i++) {
    //     std::cerr << a[i] << "\n";
    // }
    // for (int i = 0; i < n2; i++) {
    //     std::cerr << b[i] << "\n";
    // }
    // std::cerr << "mul : " << mul << "\n";
    
    std::vector<F> xs;
    
    for (int i = 0; i < n1; i++) {
        xs.push_back(a[i].x);
    }
    for (int i = 0; i < n2; i++) {
        xs.push_back(b[i].x);
    }
    
    std::sort(xs.begin(), xs.end());
    {
        auto vv = std::move(xs);
        for (auto v : vv) {
            if (xs.empty() || v - eps > xs.back()) {
                xs.push_back(v);
            }
        }
    }
    
    int m = xs.size();
    std::vector<std::vector<std::array<F, 3>>> la(m), lb(m);
    
    for (int i = 0; i < n1; i++) {
        auto [x1, y1] = a[i];
        auto [x2, y2] = a[(i + 1) % n1];
        int u = std::lower_bound(xs.begin(), xs.end(), x1 - eps) - xs.begin();
        int v = std::lower_bound(xs.begin(), xs.end(), x2 - eps) - xs.begin();
        F coef = -1;
        if (u > v) {
            std::swap(u, v);
            coef *= -1;
        }
        for (int j = u; j < v; j++) {
            // assert(std::min(x1, x2) <= xs[j] && xs[j + 1] <= std::max(x1, x2));
            F yl = (y1 * (x2 - xs[j]) + y2 * (xs[j] - x1)) / (x2 - x1);
            F yr = (y1 * (x2 - xs[j + 1]) + y2 * (xs[j + 1] - x1)) / (x2 - x1);
            la[j].push_back({yl, yr, coef});
        }
    }
    for (int i = 0; i < n2; i++) {
        auto [x1, y1] = b[i];
        auto [x2, y2] = b[(i + 1) % n2];
        int u = std::lower_bound(xs.begin(), xs.end(), x1 - eps) - xs.begin();
        int v = std::lower_bound(xs.begin(), xs.end(), x2 - eps) - xs.begin();
        F coef = -1;
        if (u > v) {
            std::swap(u, v);
            coef *= -1;
        }
        for (int j = u; j < v; j++) {
            // assert(std::min(x1, x2) <= xs[j] && xs[j + 1] <= std::max(x1, x2));
            F yl = (y1 * (x2 - xs[j]) + y2 * (xs[j] - x1)) / (x2 - x1);
            F yr = (y1 * (x2 - xs[j + 1]) + y2 * (xs[j + 1] - x1)) / (x2 - x1);
            lb[j].push_back({yl, yr, coef});
        }
    }
    
    std::vector<std::array<F, 4>> events;
    events.push_back({-1, 0, 0, 0});
    events.push_back({1001, 0, 0, 0});
    
    std::vector<std::array<F, 5>> extra;
    
    for (int i = 0; i < m - 1; i++) {
        F x = xs[i + 1] - xs[i];
        // std::cerr << la[i].size() << " " << lb[i].size() << "\n";
        // std::cerr << "xl : " << xs[i] << ", xr : " << xs[i + 1] << "\n";
        for (auto [yla, yra, ca] : la[i]) {
            for (auto [ylb, yrb, cb] : lb[i]) {
                [&, yla, yra, ca, ylb, yrb, cb]() mutable {
                    // std::cerr << yla << " " << yra << " " << ylb << " " << yrb << "\n";
                    if (ylb - yla > yrb - yra) {
                        std::swap(yla, yra);
                        std::swap(ylb, yrb);
                    }
                    F tl = ylb - yla;
                    F tr = yrb - yra;
                    
                    F lst[4] {-1};
                    F coef = ca * cb;
                    auto add = [&](F r, F c0, F c1, F c2) {
                        r = std::min(r, F(1001));
                        c0 *= coef;
                        c1 *= coef;
                        c2 *= coef;
                        if (lst[0] >= r) {
                            return;
                        }
                        // if (c2) {
                        //     extra.push_back({lst[0], r, c0 - lst[1], c1 - lst[2], c2 - lst[3]});
                        //     events.push_back({lst[0], 0, 0, 0});
                        //     lst[0] = r;
                        //     return;
                        // }
                        events.push_back({lst[0], c0 - lst[1], c1 - lst[2], c2 - lst[3]});
                        lst[0] = r;
                        lst[1] = c0;
                        lst[2] = c1;
                        lst[3] = c2;
                    };
                    add(tl, (yla + yra) * x, x * 2, 0);
                    // std::cerr << "tl : " << tl << ", tr : " << tr << "\n";
                    if (tl + eps < tr) {
                        F dt = tr - tl;
                        F c = x / dt / dt;
                        F c0 = c * (ylb * -tl * (2 * tr - tl) + yrb * tl * tl + yla * tr * tr + yra * tr * (tr - 2 * tl));
                        F c1 = c * 2 * (ylb * tr - yrb * tl - yla * tr + yra * tl + tr * dt);
                        F c2 = c * -dt;
                        // std::cerr << c0 << " " << c1 << " " << c2 << "\n";
                        // {
                        //     // std::cerr << c0 + c1 * tl + c2 * tl * tl << " " << (yla + yra) * x + x * tl * 2 << "\n";
                        //     assert(std::abs<double>((c0 + c1 * tl + c2 * tl * tl) - ((yla + yra) * x + x * tl * 2)) < eps + 1E-8);
                        //     // std::cerr << c0 + c1 * tr + c2 * tr * tr << " " << (ylb + yrb) * x << "\n";
                        //     assert(std::abs<double>((c0 + c1 * tr + c2 * tr * tr) - ((ylb + yrb) * x)) < eps + 1E-8);
                        //     F tm = (tl + tr) / 2;
                        //     // std::cerr << c0 + c1 * tm + c2 * tm * tm << " " << (ylb + (ylb + yrb) / 2) * x / 2 + ((yla + yra) / 2 + yra) * x / 2 + x * tm << "\n";
                        //     assert(std::abs<double>((c0 + c1 * tm + c2 * tm * tm) - ((ylb + (ylb + yrb) / 2) * x / 2 + ((yla + yra) / 2 + yra) * x / 2 + x * tm)) < eps + 1E-8);
                        // }
                        add(tr, c0, c1, c2);
                    }
                    add(F(1001), (ylb + yrb) * x, 0, 0);
                } ();
            }
        }
    }
    
    std::sort(events.begin(), events.end());
    for (int i = 1; i < events.size(); i++) {
        events[i][1] += events[i - 1][1];
        events[i][2] += events[i - 1][2];
        events[i][3] += events[i - 1][3];
    }
    for (auto [l, r, c0, c1, c2] : extra) {
        int u = std::upper_bound(events.begin(), events.end(), std::array<F, 4>{l + eps, INFINITY, INFINITY, INFINITY}) - events.begin() - 1;
        int v = std::upper_bound(events.begin(), events.end(), std::array<F, 4>{r + eps, INFINITY, INFINITY, INFINITY}) - events.begin() - 1;
        for (int i = u; i < v; i++) {
            events[i][1] += c0;
            events[i][2] += c1;
            events[i][3] += c2;
        }
    }
    // for (auto [a, b, c, d] : events) {
    //     std::cerr << a << " " << b << " " << c << " " << d << "\n";
    // }
    std::vector<F> sum(events.size());
    for (int i = 0; i < events.size() - 1; i++) {
        auto [xl, c0, c1, c2] = events[i];
        auto xr = events[i + 1][0];
        sum[i + 1] = sum[i] + (xr - xl) * (c0 + c1 * (xl + xr) / 2 + c2 * (xr * xr + xl * xr + xl * xl) / 3);
    }
    // for (int i = 0; i < events.size(); i++) {
    //     auto [a, b, c, d] = events[i];
    //     std::cerr << a << " " << b << " " << c << " " << d << "\n";
    // }
    // for (int i = 0; i < events.size() - 1; i++) {
    //     F cl, cr;
    //     F x = events[i + 1][0];
    //     {
    //         auto [_, c0, c1, c2] = events[i];
    //         cl = c0 + c1 * x + c2 * x * x;
    //     }
    //     {
    //         auto [_, c0, c1, c2] = events[i + 1];
    //         cr = c0 + c1 * x + c2 * x * x;
    //     }
    //     std::cerr << x << " " << cl << " " << cr << "\n";
    // }
    
    int q;
    std::cin >> q;
    
    for (int i = 0; i < q; i++) {
        int t1, t2;
        std::cin >> t1 >> t2;
        
        int u = std::upper_bound(events.begin(), events.end(), std::array<F, 4>{t1 + eps, INFINITY, INFINITY, INFINITY}) - events.begin() - 1;
        int v = std::upper_bound(events.begin(), events.end(), std::array<F, 4>{t2 + eps, INFINITY, INFINITY, INFINITY}) - events.begin() - 1;
        
        F ans = 0;
        if (t1 == t2) {
            auto [t, c0, c1, c2] = events[u];
            ans = ((c2 * t1) + c1) * t1 + c0;
        } else {
            ans = sum[v] - sum[u];
            // std::cerr << u << " " << v << " " << events[u][0] << " " << events[v][0] << " " << ans << " ";
            {
                auto [xl, c0, c1, c2] = events[u];
                auto xr = t1;
                ans -= (xr - xl) * (c0 + c1 * (xl + xr) / 2 + c2 * (xr * xr + xl * xr + xl * xl) / 3);
            }
            // std::cerr << ans << " ";
            {
                auto [xl, c0, c1, c2] = events[v];
                auto xr = t2;
                ans += (xr - xl) * (c0 + c1 * (xl + xr) / 2 + c2 * (xr * xr + xl * xr + xl * xl) / 3);
            }
            ans /= t2 - t1;
        }
        ans *= mul;
        std::cout << double(ans) << "\n";
    }
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    std::cout << std::fixed << std::setprecision(10);
    
    int T;
    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: 1ms
memory: 3828kb

input:

1
0 0 3 0 -1
4 1
1 0
3 0
3 2
1 2
4 2
0 0
1 0
1 1
0 1
3
0 10
1 2
1 1

output:

0.4500000000
1.1250000000
2.2500000000

result:

ok 3 numbers

Test #2:

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

input:

1
-5448 2169 9 731 -431
64 1
-7417 -2691
-7203 -4235
-6869 -6172
-6746 -6856
-6628 -7104
-5983 -7731
-5755 -7926
-4211 -8457
-3739 -8585
-3653 -8604
-2307 -8877
-998 -9109
-201 -9110
874 -9110
2692 -8754
2984 -8696
3438 -8597
3671 -8536
5152 -8058
5700 -7775
5892 -7619
6304 -7221
7388 -5673
7742 -51...

output:

910.0176895790

result:

ok found '910.01769', expected '910.01769', error '0.00000'

Test #3:

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

input:

10000
-8 -1 6 -1 -5
3 1
-7 7
-6 -3
3 6
3 4
-7 3
10 -2
-7 4
5
5 7
1 1
0 0
0 5
1 8
-10 -4 10 -8 7
5 4
-9 1
-8 -7
4 -9
5 7
3 9
5 8
-8 4
2 -10
4 -8
10 1
8 9
7
3 9
1 3
7 9
6 10
3 9
0 1
3 3
-2 9 9 4 -3
3 4
-10 10
-6 -7
8 -5
3 5
-9 1
-2 -2
7 1
3
6 7
2 7
4 5
-10 4 7 -2 5
3 3
-10 7
-8 -9
-3 10
3 4
-9 9
2 -9
...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
52.8183048128
70.1854691860
71.0462933323
-0.0000000000
-0.0000000000
0.0043758282
7.2759043508
2.2404240550
4.4367251754
-0.0000000000
0...

result:

ok 100000 numbers

Test #4:

score: 0
Accepted
time: 511ms
memory: 3952kb

input:

10000
7 2 9 -3 10
5 1
-10 8
-7 4
-4 1
0 -2
10 3
3 6
-10 10
-8 -4
7 -10
4
0 8
3 3
1 1
0 1
-9 3 10 -5 -3
3 3
-10 -7
3 -2
7 10
3 6
-9 1
-7 8
-8 10
2
5 9
6 7
-6 -8 9 -3 9
3 6
-1 -8
3 -10
3 -5
4 8
-9 -3
7 -6
9 6
-8 9
3
3 7
2 9
1 4
3 4 7 9 -6
4 1
-10 9
4 -10
7 -10
8 10
4 2
-10 1
2 -5
4 -3
3 4
4
6 6
2 7
6 ...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
4.9523809524
41.5555555556
7.4801120746
25.5052806918
7.4801120746
8.8055128440
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0024254061
2.9476765651
0.0000000000
0.0000000000
0.0000000000
0.0000000000...

result:

ok 100000 numbers

Test #5:

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

input:

10000
-7 8 9 6 10
5 2
-7 -1
-4 -7
3 -3
6 6
-7 5
4 8
-9 0
-4 -10
3 4
-4 4
6
3 8
5 7
7 8
8 10
0 5
6 6
7 -5 9 -3 -2
4 4
-3 3
8 -5
8 -4
7 7
4 7
-9 3
-6 -2
10 2
2 5
4
5 10
2 5
6 7
1 8
9 -7 9 8 -5
3 2
-7 7
-6 -1
1 5
5 4
-5 -9
5 -10
8 2
2 5
-3 3
9
5 6
8 9
0 2
4 6
0 0
3 3
4 7
2 3
2 7
-2 -7 7 -5 3
3 1
1 10
2...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
51.2025641977
0.0003055141
51.2448979592
27.5434475608
0.0002036761
41.4005795045
10.3120796712
0.0000000000
0.0000000000
5.5380024646
0.0000000...

result:

ok 100000 numbers

Test #6:

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

input:

10000
3 7 10 -7 -3
5 2
-1 1
6 -7
8 -2
4 4
-1 6
3 8
-6 -3
-2 -7
-2 9
1
1 7
-2 -5 7 -5 5
3 1
-9 1
10 -7
8 9
3 6
-2 4
5 -6
6 10
5
2 10
5 7
4 10
1 2
1 5
-2 0 10 1 5
3 1
-4 10
7 3
3 6
3 2
-9 4
-4 -9
-6 0
2
3 4
3 10
2 4 10 -3 -6
3 1
-7 5
-5 -7
10 -3
5 7
-9 -6
-7 -9
2 -9
5 -7
0 -3
10
2 10
6 7
0 1
1 5
5 5
6...

output:

5.7843469178
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
11.1907147656
0.0000000000
0.0007474236
38.3111562526
0.0000000000
0.0000000000
0.0000000000
87.5082307462
21.8920892872
110.0160065928
11.6300075586
23.8083900227
98.5396175235
66.4603174603
55.5...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 509ms
memory: 3852kb

input:

10000
-7 -9 8 -2 -9
4 5
-8 -7
4 -9
5 8
-8 4
4 7
-7 2
0 -5
6 6
-6 9
3
8 10
4 6
2 5
-3 -2 10 10 -8
3 6
-9 0
-7 -6
4 7
5 9
-10 4
-6 -8
2 -8
-2 3
-8 4
2
2 5
6 10
-8 -7 9 2 5
4 2
-10 -4
9 -2
7 5
2 10
5 3
-8 6
-5 -9
9 -5
4 7
-4 7
1
8 8
-7 -7 10 7 7
4 5
-10 -8
6 -4
6 3
-2 8
4 8
-9 -9
8 8
6 8
-4 4
8
3 8
3 8...

output:

0.0000000000
0.0000000000
0.0000000000
-0.0000000000
-0.0000000000
108.9928352088
5.5652557319
5.5652557319
49.8643590234
0.0000000000
142.9861445930
0.0000000000
79.0723730211
62.3304487792
17.9760067607
-0.0000000000
36.3187369586
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0....

result:

ok 100000 numbers

Test #8:

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

input:

10000
7 -5 9 2 10
3 1
-2 2
9 -2
10 2
3 6
-10 -5
5 6
-5 10
1
5 5
-9 3 8 -9 -7
4 3
-10 -4
9 1
4 5
-8 8
3 7
-7 -2
9 -2
7 8
12
5 7
7 8
0 0
2 5
3 5
5 10
3 4
3 8
1 7
5 8
2 9
3 10
-5 0 9 -3 -8
5 4
-10 -2
3 -8
9 5
6 9
-5 8
4 8
-10 -3
6 -3
10 2
7 10
8
1 6
4 6
8 8
1 5
4 7
7 8
2 9
4 8
-10 -4 9 6 -5
5 5
3 -1
9 ...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
-0.0000000000
19.5787146226...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 513ms
memory: 4100kb

input:

10000
-8 -5 4 -1 5
3 1
-3 -8
0 -5
2 5
4 2
-5 -5
9 7
9 10
-2 8
10
1 6
4 5
3 10
1 6
1 2
1 3
0 4
9 9
6 8
1 3
8 3 5 8 2
5 1
-7 -8
3 -7
-1 -2
-5 1
-7 -7
4 4
-4 -3
-1 -7
7 -8
-1 7
12
3 7
8 8
9 10
4 5
6 8
1 8
0 5
2 9
5 8
5 5
0 0
2 7
-1 8 10 -9 -7
6 1
-3 -6
1 -8
6 -7
6 -5
0 6
-2 5
4 5
-7 8
-6 -7
5 -3
2 9
9
...

output:

6.1298604012
-0.0000000000
0.0259259259
6.1298604012
19.9806003373
15.2339102623
11.0805781238
0.0000000000
0.0000000000
15.2339102623
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
-0.0000000000
0.0000000000
25.80540...

result:

ok 100000 numbers

Test #10:

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

input:

10000
-2 -5 7 -3 6
3 2
-3 -7
9 -8
1 -7
5 5
-9 -10
6 -3
8 -1
-4 7
-5 4
4
1 5
6 10
8 10
0 4
6 -5 10 9 -3
6 4
-6 -8
1 -10
7 -6
3 4
-4 10
-6 -2
4 9
-7 -6
-2 -8
2 -8
10 6
8
4 7
2 10
0 1
2 2
2 8
3 9
0 3
0 5
-7 -5 9 8 7
3 4
-8 6
-2 4
6 3
4 5
-10 -9
-5 -8
-1 0
-6 -3
17
0 9
6 10
1 10
6 6
0 5
10 10
8 9
3 4
0 ...

output:

1.6374139169
-0.0000000000
-0.0000000000
2.5657221227
-0.0000000000
-0.0000000000
1.8768138001
-0.0000000000
-0.0000000000
-0.0000000000
0.6256046000
0.3753627600
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.00000...

result:

ok 100000 numbers

Test #11:

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

input:

10000
-7 -8 9 -1 5
5 6
-5 10
1 -5
9 -10
10 -1
-2 10
3 7
-8 -9
5 -7
-8 -1
5
2 5
0 2
8 10
6 8
0 4
-6 -3 10 1 -5
3 7
-10 -6
7 8
-1 7
4 8
-8 8
-4 6
8 6
2 7
1
8 8
1 -6 8 2 -4
3 1
-9 -9
7 -1
-6 7
4 2
-10 10
-5 6
4 1
8 1
6
7 9
3 6
9 9
2 10
8 10
1 2
0 -8 10 -10 -3
4 4
-4 -10
7 7
8 9
6 10
3 9
-8 0
8 -3
4 6
1...

output:

-0.0000000000
108.5219350692
-0.0000000000
-0.0000000000
54.2609675346
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
220.2000000000
31.0305357143
-0.000000000...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 513ms
memory: 4020kb

input:

10000
-5 3 9 -4 -1
3 2
-1 2
8 -3
0 10
3 8
-5 -5
10 -8
6 5
8
0 1
4 10
8 9
5 10
5 10
4 4
0 1
0 7
1 2 6 8 6
3 2
-9 -9
-3 -7
-4 10
4 5
-9 9
-5 1
-1 -5
6 9
2
3 9
1 5
-2 0 9 8 0
4 2
-5 -10
8 -9
9 3
-2 9
5 8
-10 1
-9 -3
7 -7
2 3
1 3
13
4 6
6 8
3 10
4 6
1 2
4 5
6 10
2 6
1 3
4 9
2 3
0 9
8 8
-10 -8 8 -2 -10
4...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
-0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
25.8469387755
0.0000000000...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 467ms
memory: 3928kb

input:

3000
78 -37 984 -936 -370
9 158
-911 94
-338 -910
-20 -938
746 -972
922 -628
988 107
951 719
-94 936
-815 876
7 717
-960 -107
-231 -851
-112 -963
136 -970
979 99
565 655
-821 120
66
61 89
53 73
5 67
100 100
60 60
22 74
40 68
29 95
81 89
73 75
2 65
3 70
41 64
13 61
38 52
74 82
72 85
89 92
62 77
28 39...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0...

result:

ok 100000 numbers

Test #14:

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

input:

3000
-67 75 588 514 -204
9 202
-942 678
-809 -376
-438 -910
-301 -967
827 -834
993 -83
1000 216
976 793
323 776
12 457
-982 -27
-923 -331
-851 -666
-297 -900
60 -944
884 -419
910 -275
751 478
182 984
-633 830
-863 783
-962 653
5
17 52
37 38
89 89
51 97
56 93
62 -58 758 475 38
6 695
-865 872
-439 -45...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
13671.1772450055
0.0000000000
0.0000000000
23746.1771867343
0.0000000000
0.0000000000
0.0000000000
-0.000...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 465ms
memory: 4012kb

input:

3000
-58 -85 960 -15 286
12 387
-964 109
-899 -184
-109 -853
72 -904
953 -741
970 -497
991 397
857 779
830 852
699 968
-755 985
-959 527
8 596
-983 -850
-294 -923
842 -841
989 -207
976 635
724 935
-551 949
-980 927
6
36 66
77 87
29 51
55 99
70 89
79 89
-99 -7 795 556 995
6 442
-835 229
-752 -635
-24...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
1029799.3602867963
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 466ms
memory: 3880kb

input:

3000
75 84 988 574 -757
10 504
-967 -610
-882 -924
724 -893
793 -867
873 -595
985 -35
633 490
175 865
-851 935
-965 -353
7 765
-803 -198
-404 -915
221 -987
820 -755
933 359
809 908
-543 329
26
74 91
29 71
10 80
34 37
77 89
0 21
59 86
25 65
79 98
16 56
21 34
12 55
6 26
67 73
30 66
29 40
3 78
13 57
21...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
1196864.3814331009
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
192.1868952017
0.0000000000
0.0000000000
0.0000000000
3603.5042850323
0.0000000000
0.0...

result:

ok 100000 numbers

Test #17:

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

input:

3000
-26 86 643 337 -777
8 449
-891 24
-831 -802
735 -975
879 -627
978 385
998 761
-523 930
-827 579
7 563
-791 -579
220 -766
484 -747
770 -607
942 456
929 959
-599 941
63
26 47
1 34
66 72
1 23
19 91
34 73
7 48
15 60
25 69
10 99
6 93
37 92
32 46
26 94
58 64
21 21
5 29
21 80
48 94
24 99
12 31
17 88
3...

output:

-0.0000000000
716454.4585098823
-0.0000000000
1074681.6877648237
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.00000000...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 470ms
memory: 3928kb

input:

3000
-62 -78 898 -314 288
6 168
-995 624
164 -897
849 -726
889 899
-14 886
-679 826
5 850
-891 -849
-707 -830
867 -141
665 881
-850 715
35
10 52
23 56
61 95
63 96
41 58
29 72
23 28
7 92
24 40
15 62
85 89
1 59
20 20
63 71
10 37
29 48
12 67
2 2
53 53
7 81
15 75
6 76
16 63
6 32
14 76
13 74
22 87
2 17
3...

output:

-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
104457.2920684305
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
3502974.9408031525
-0.0000000000
-0.0000000000
-0.00000000...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 467ms
memory: 3880kb

input:

3000
-1 40 801 18 45
10 245
-920 431
-743 -781
-403 -926
769 -887
960 -462
893 970
775 994
-132 970
-873 903
-904 853
10 690
-935 -206
-834 -359
164 -980
432 -915
865 -780
894 -669
1000 746
-36 778
-474 529
-908 -115
27
49 67
1 90
9 89
15 39
14 43
62 75
89 94
7 72
11 83
17 99
50 87
63 86
46 71
12 20...

output:

-0.0000000000
1457170.0111034762
942960.6202543174
1447882.6005949907
1432062.0263941521
-0.0000000000
-0.0000000000
1369225.6917278676
859361.5177552694
272620.8392517704
-0.0000000000
-0.0000000000
-0.0000000000
5773545.1103265984
1569260.9546789646
111531.9709367527
6765376.8553725574
-0.00000000...

result:

ok 100000 numbers

Test #20:

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

input:

3000
-37 -8 747 354 -861
11 228
-956 540
-880 -451
-824 -979
-113 -982
950 -978
907 371
799 750
728 914
69 940
-460 928
-824 844
10 255
-966 747
-897 -782
-817 -850
-662 -890
237 -977
936 -756
965 -624
999 115
741 762
-45 809
52
11 54
77 77
43 95
18 42
62 90
0 39
1 91
9 34
6 31
8 47
51 84
17 46
38 8...

output:

1422077.6633087588
-0.0000000000
-0.0000000000
1358469.7578077477
-0.0000000000
3228392.6755120181
1325934.4288914513
2777045.0330582284
3338493.5501748659
1961814.7923425983
-0.0000000000
1243685.5848235136
3810.0218358341
1528168.3376850323
-0.0000000000
390535.8103691725
1040562.3637277021
191053...

result:

ok 100000 numbers

Test #21:

score: 0
Accepted
time: 468ms
memory: 3932kb

input:

3000
48 -100 669 827 134
9 2
-985 -262
-952 -447
-241 -935
476 -920
742 -849
999 -527
992 781
12 898
-812 886
8 27
-988 459
-822 -477
-733 -682
-478 -990
659 -796
765 607
466 762
-708 662
46
1 9
13 96
74 83
86 86
31 81
76 95
28 68
52 78
73 93
16 92
7 52
57 85
51 82
80 99
56 80
22 65
73 86
2 33
69 69...

output:

2301237.8440753985
397173.5541894158
0.0000000000
0.0000000000
170724.7896938003
0.0000000000
284680.0489549843
613.9864608653
0.0000000000
363900.3705099550
1001711.5508908695
0.0000000000
1805.3880787521
0.0000000000
0.0000000000
431073.5307259309
0.0000000000
1608158.1119926667
0.0000000000
60817...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 470ms
memory: 3928kb

input:

3000
36 28 965 -40 913
8 290
-933 539
-647 -708
-94 -797
499 -690
844 169
802 576
-373 648
-928 639
6 400
-951 -965
884 -896
739 661
618 933
-789 995
-895 -255
53
66 98
1 30
0 25
77 77
2 4
27 62
62 91
92 96
33 69
17 100
66 66
17 67
18 27
48 80
16 47
17 90
45 96
14 61
15 82
81 85
86 89
22 82
70 85
67...

output:

-0.0000000000
801410.1622378033
1098530.6229832317
-0.0000000000
4041049.9940311634
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.000...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 187ms
memory: 4620kb

input:

60
-2 -1 6 -692 -914
5 1
-39 64
14 -67
53 -14
59 5
37 51
7 5
-105 23
-63 -14
-24 -17
4 -19
12 -17
-16 23
-24 26
948
6 6
1 4
3 8
444 444
9 758
4 8
212 985
365 415
629 647
168 395
55 746
2 7
69 616
595 900
5 7
6 9
8 8
181 424
3 9
5 5
228 978
622 711
714 948
6 7
152 152
878 878
62 966
2 5
1 8
99 131
86...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0...

result:

ok 100000 numbers

Test #24:

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

input:

60
2 -1 10 -9 -5
6 3
-64 -9
-25 -20
3 -16
26 7
-2 18
-41 14
118 8
-13458 1788
-13400 -150
-13174 -3448
-12376 -10187
-11659 -16224
-11423 -18192
-11178 -19459
-9694 -24458
-9018 -26389
-8654 -27421
-7753 -29655
-6590 -32133
-5887 -33359
-4543 -35667
-4092 -36278
-3268 -37365
-2246 -38667
-1091 -4006...

output:

4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918367
4498.9795918...

result:

ok 100000 numbers

Test #25:

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

input:

60
3 4 8 6 -6
8 4
-70 -8
-20 -7
33 11
35 58
33 75
-11 81
-48 63
-54 57
7 5
0 3
12 -7
34 -23
64 -42
79 -46
117 -27
80 24
3319
185 435
764 879
7 282
2 5
116 767
499 763
1 1
2 8
400 627
103 489
563 795
43 860
427 512
24 353
123 123
257 896
2 4
3 7
498 498
896 992
1 6
138 890
228 739
397 519
651 868
0 9...

output:

-0.0000000000
-0.0000000000
2069.5415280941
1549.8438393485
-0.0000000000
-0.0000000000
590.3227134681
2196.0241816409
-0.0000000000
-0.0000000000
-0.0000000000
183.6014664771
-0.0000000000
1328.6259780858
-0.0000000000
-0.0000000000
1346.3800804498
2181.3560327061
-0.0000000000
-0.0000000000
1562.0...

result:

ok 100000 numbers

Test #26:

score: 0
Accepted
time: 173ms
memory: 4604kb

input:

60
-10 4 99050 -3 6
7 26049
-45 27
53 -70
97 -112
110 -89
122 -47
123 -35
88 39
11 77577
-14 17
-11 -30
9 -80
52 -75
110 -65
143 -36
161 40
158 58
122 70
89 65
4 43
2233
161 663
162 922
6 8
889 963
232 251
661 739
818 971
7 10
287 999
1 6
5 9
0 3
466 749
277 277
4 10
236 442
871 925
2 9
207 843
374 ...

output:

-0.0000000000
-0.0000000000
13309.8049366650
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
9522.1431179848
-0.0000000000
20072.6268879397
13269.4800026109
22224.3369618616
-0.0000000000
-0.0000000000
13186.1774471385
-0.0000000000
-0.0000000000
16304.2904163464
-0.0000000000
-0.0000000000
...

result:

ok 100000 numbers

Test #27:

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

input:

60
-14255 85728 83963 -625 308
6 7088
-10 10
-8 -41
19 -75
119 -24
163 10
182 44
406 8385
-17623 -590
-17616 -755
-17575 -1522
-17432 -4162
-17366 -4990
-17355 -5120
-17302 -5701
-17280 -5928
-17188 -6832
-17103 -7636
-17051 -8062
-16943 -8925
-16884 -9331
-16757 -10203
-16742 -10303
-16725 -10408
-...

output:

13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.4160207232
13749.41602...

result:

ok 100000 numbers

Test #28:

score: 0
Accepted
time: 151ms
memory: 4620kb

input:

60
6 1 98772 -10 0
9 50424
-173 -37
-50 -40
-35 -38
-31 -35
-8 21
-8 24
-13 95
-91 93
-158 90
252 60791
-46140 5792
-46125 3833
-46121 3699
-46025 1061
-45927 -1169
-45841 -2463
-45718 -3974
-45673 -4509
-45536 -6005
-45390 -7474
-45234 -8942
-45170 -9480
-44996 -10847
-44670 -12865
-44082 -15910
-4...

output:

82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.6465073489
82574.64650...

result:

ok 100000 numbers

Test #29:

score: 0
Accepted
time: 157ms
memory: 4704kb

input:

60
-4177 -13751 89389 6 -9
6 23007
-90 -47
-26 -74
38 -85
76 41
38 52
-26 11
13 59759
-74 -6
-69 -30
-47 -32
-45 -32
-29 -31
11 -21
82 -2
74 20
57 29
52 31
-3 32
-49 31
-73 4
2743
376 815
158 554
31 497
566 652
134 242
1 7
103 680
8 8
1 9
191 530
190 190
465 526
380 957
1 10
929 987
1 1
2 5
267 817
...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0...

result:

ok 100000 numbers

Test #30:

score: 0
Accepted
time: 154ms
memory: 4772kb

input:

60
10 -7 76710 1 -10
15 1799
-107 125
-97 40
-80 -29
-76 -35
-40 -34
-17 -30
-11 -28
7 -15
9 40
3 64
-13 113
-15 117
-21 126
-61 139
-96 145
14 4198
-108 39
-107 29
-101 10
-71 -27
-36 -62
1 -70
27 -52
51 -17
58 6
44 68
18 87
-26 83
-55 76
-106 60
3271
1 8
298 463
507 992
493 766
641 641
5 8
4 4
300...

output:

11344.0393131731
6161.7743801455
179.1611548465
433.0389476968
0.0000000000
11400.0380769333
11330.3062066242
2416.3835624155
11344.1847228410
4888.4351441651
1302.4835217730
5021.5304362028
9386.1910847444
1111.5043007293
11315.9429915145
11358.3298234489
13468.3899949363
11259.6049385293
11216.757...

result:

ok 100000 numbers

Test #31:

score: 0
Accepted
time: 171ms
memory: 4608kb

input:

60
85399 -87912 4 -5 2
6 1
-19 34
10 -4
44 -28
104 2
134 20
40 38
5 3
-122 -3
1 -23
61 -13
50 7
-10 79
229
714 801
683 855
3 10
42 609
3 6
5 5
98 637
0 10
0 6
7 8
665 995
4 6
337 664
3 8
374 855
637 637
143 318
6 8
27 365
287 327
4 5
41 960
1 3
154 820
73 394
18 636
0 5
859 880
4 8
382 470
491 840
6...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0...

result:

ok 100000 numbers

Test #32:

score: 0
Accepted
time: 181ms
memory: 4768kb

input:

60
-10 7 7 1 5
6 1
-162 -58
-24 -49
-6 -7
-10 17
-24 36
-86 41
648 4
-23029 2131
-23020 1272
-23019 1186
-23017 1020
-23015 906
-23008 584
-22997 156
-22992 -27
-22984 -265
-22972 -592
-22943 -1360
-22914 -2016
-22903 -2230
-22896 -2363
-22847 -3242
-22811 -3860
-22741 -5008
-22710 -5485
-22692 -576...

output:

13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.9722222222
13636.97222...

result:

ok 100000 numbers

Test #33:

score: 0
Accepted
time: 478ms
memory: 5576kb

input:

60
15682 -4744 10 10 2
743 3
-15894 -2108
-15889 -2921
-15885 -3142
-15876 -3485
-15870 -3697
-15861 -3979
-15848 -4333
-15811 -5217
-15798 -5508
-15785 -5776
-15775 -5971
-15772 -6024
-15754 -6327
-15751 -6372
-15728 -6655
-15708 -6893
-15700 -6983
-15611 -7954
-15598 -8095
-15590 -8179
-15558 -851...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0...

result:

ok 100000 numbers

Test #34:

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

input:

60
-8064 19156 8 6 0
728 2
-9570 256
-9569 -101
-9568 -313
-9559 -1075
-9556 -1302
-9551 -1625
-9540 -2015
-9537 -2112
-9532 -2260
-9520 -2581
-9519 -2605
-9501 -2996
-9499 -3039
-9486 -3312
-9482 -3388
-9456 -3758
-9437 -4025
-9412 -4331
-9405 -4407
-9315 -5328
-9261 -5813
-9237 -6025
-9232 -6069
-...

output:

1997087249.5267291069
1997195902.0584328175
1996978600.2069656849
1996848106.0375120640
1959497389.3330392838
1997022081.1336748600
1997195900.4524626732
1985049143.0077636242
1971255131.6309981346
1955292374.6902835369
1959805154.7387216091
1972371846.3570666313
1997065536.3648643494
1997239331.594...

result:

ok 100000 numbers

Test #35:

score: 0
Accepted
time: 454ms
memory: 5796kb

input:

60
16409 -38207 8 -5 2
744 1
-14468 -2661
-14467 -2844
-14466 -3006
-14465 -3132
-14459 -3703
-14456 -3918
-14454 -4054
-14451 -4254
-14448 -4408
-14432 -5131
-14419 -5604
-14415 -5743
-14409 -5942
-14408 -5972
-14406 -6029
-14404 -6085
-14368 -7053
-14352 -7450
-14329 -7995
-14311 -8406
-14293 -876...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0...

result:

ok 100000 numbers

Test #36:

score: 0
Accepted
time: 458ms
memory: 5456kb

input:

60
27332 65498 94576 -4 -10
689 4897
-7628 -631
-7626 -722
-7624 -801
-7617 -1002
-7613 -1070
-7609 -1133
-7608 -1145
-7604 -1189
-7595 -1281
-7592 -1309
-7577 -1421
-7559 -1555
-7556 -1572
-7533 -1661
-7521 -1706
-7507 -1755
-7486 -1825
-7469 -1880
-7457 -1911
-7443 -1946
-7422 -1997
-7339 -2195
-7...

output:

160563494.2743892968
160510702.0135069788
160500143.4785424769
168053074.2452919781
160584611.0432708859
168327556.6878057420
170603640.5051395595
160595169.5406044722
177793598.4005465806
169560447.7873423994
176699636.0635464787
160626844.4305104017
160468467.6478634477
171993863.3323245943
160531...

result:

ok 100000 numbers

Test #37:

score: 0
Accepted
time: 455ms
memory: 5788kb

input:

60
-5 3 72675 -283 -74
739 14232
-10968 -3618
-10966 -4287
-10964 -4465
-10958 -4734
-10947 -5225
-10925 -5992
-10917 -6262
-10909 -6489
-10892 -6934
-10855 -7884
-10849 -8033
-10836 -8340
-10826 -8563
-10811 -8879
-10786 -9397
-10762 -9829
-10746 -10098
-10725 -10425
-10712 -10620
-10690 -10947
-10...

output:

3412605691.9235310555
3364513364.6469979286
5701557339.6937952042
4745145647.6396865845
5701394995.9471721649
5701151837.1795406342
5701520196.0408954620
5540562065.0189809799
4373902356.2890281677
3409467708.8263344765
5076629690.0677537918
5701557339.6937952042
5701557339.6937952042
5701557339.693...

result:

ok 100000 numbers

Test #38:

score: 0
Accepted
time: 148ms
memory: 7884kb

input:

1
-100000 -100000 95539 1 1
4924 27493
-49998 -2337
-49997 -2614
-49996 -2812
-49995 -2999
-49994 -3146
-49993 -3280
-49992 -3405
-49991 -3524
-49989 -3741
-49988 -3846
-49987 -3941
-49986 -4034
-49985 -4124
-49983 -4289
-49982 -4371
-49980 -4527
-49978 -4679
-49976 -4826
-49975 -4897
-49973 -5035
-...

output:

0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0...

result:

ok 100000 numbers

Test #39:

score: 0
Accepted
time: 128ms
memory: 5724kb

input:

1
100000 100000 79129 -1 -1
1974 7644
-24991 -2249
-24990 -2309
-24989 -2368
-24988 -2423
-24987 -2474
-24986 -2522
-24984 -2614
-24983 -2659
-24981 -2735
-24980 -2772
-24979 -2808
-24978 -2842
-24977 -2875
-24974 -2971
-24970 -3095
-24966 -3215
-24964 -3273
-24963 -3301
-24962 -3327
-24958 -3427
-2...

output:

-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.0000000000
-0.000...

result:

ok 100000 numbers

Test #40:

score: 0
Accepted
time: 189ms
memory: 7072kb

input:

1
-100000 100000 66194 1 -1
4800 11259
-99982 -37373
-99981 -37487
-99979 -37713
-99978 -37814
-99977 -37911
-99975 -38103
-99974 -38192
-99973 -38272
-99971 -38428
-99970 -38501
-99969 -38573
-99967 -38715
-99965 -38848
-99963 -38979
-99962 -39038
-99960 -39155
-99959 -39210
-99958 -39264
-99957 -3...

output:

3705213757.8209095001
3679576489.6837258339
3671089348.2130899429
3674502015.9205422401
3705213758.0980935097
3685172897.2819046974
3692742780.3790330887
3680749261.0186085701
3666710875.2155094147
3676528921.8903398514
3668119007.0641846657
3670021327.8089094162
3678303905.8578815460
3671425975.244...

result:

ok 100000 numbers

Extra Test:

score: 0
Extra Test Passed