QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#884398#9547. Two Convex HolesUESTC_NLNSAC ✓114ms10296kbC++204.9kb2025-02-06 02:46:302025-02-06 02:46:40

Judging History

This is the latest submission verdict.

  • [2025-02-06 02:46:40]
  • Judged
  • Verdict: AC
  • Time: 114ms
  • Memory: 10296kb
  • [2025-02-06 02:46:30]
  • Submitted

answer

#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;
using ldb = long double;
struct pt {
    ldb x, y;
    pt operator+(const pt& o) const { return {x + o.x, y + o.y}; };
    pt operator-(const pt& o) const { return {x - o.x, y - o.y}; };
    pt operator*(const ldb o) const { return {x * o, y * o}; };
    ldb operator*(const pt& o) const { return o.x * x + o.y * y; }
    ldb operator^(const pt& o) const { return x * o.y - y * o.x; }
};

pt rotate(const pt& a, const pt& v2) {
    return {v2 * a, v2 ^ a};
}
struct seg {
    pt a, b;
    bool operator<(const seg& o) const {
        if (a.y != o.a.y) a.y < o.a.y;
        return b.y < o.b.y;
    }
    pt at(ldb y) const {
        return (b * (y - a.y) + a * (b.y - y)) * (1 / (b.y - a.y));
    }
};
struct poly {
    ldb t, a0, a1, a2, a3;
    bool operator<(const poly& o) const { return t < o.t; }
};
struct item {
    ldb t, v1, v2;
};
int t;
const ldb eps = 1e-12;
void solve() {
    pt a0, v;
    ldb z0, z1, z2;
    cin >> a0.x >> a0.y >> z0 >> v.x >> v.y;
    int n1, n2;
    cin >> n1 >> z1;
    vector<pt> c1(n1);
    for (int i = 0; i < n1; ++i) cin >> c1[i].x >> c1[i].y;
    cin >> n2 >> z2;
    vector<pt> c2(n2);
    for (int i = 0; i < n2; ++i) cin >> c2[i].x >> c2[i].y;
    ldb alp1 = z0 / (z0 - z1);
    ldb alp2 = z0 / (z0 - z2);
    v = v * (alp1 - alp2);
    ldb beta = v * v;
    v = v * (1 / beta);
    for (auto& u : c1) u = rotate((u - a0) * alp1, v);
    for (auto& u : c2) u = rotate((u - a0) * alp2, v);
    vector<seg> s1, s2, s3, s4;
    for (int i = 0; i < n1; ++i) {
        auto a = c1[i], b = c1[i == n1 - 1 ? 0 : i + 1];
        if (abs(a.y - b.y) < eps) continue;
        if (a.y > b.y)
            s1.push_back({b, a});
        else
            s2.push_back({a, b});
    }
    for (int i = 0; i < n2; ++i) {
        auto a = c2[i], b = c2[i == n2 - 1 ? 0 : i + 1];
        if (abs(a.y - b.y) < eps) continue;
        if (a.y > b.y)
            s3.push_back({b, a});
        else
            s4.push_back({a, b});
    }
    sort(s1.begin(), s1.end());
    sort(s2.begin(), s2.end());
    sort(s3.begin(), s3.end());
    sort(s4.begin(), s4.end());

    vector<item> q;
    auto update = [&](const seg& s, const seg& t, ldb z0, ldb z1, int f) -> void {
        if (abs(z0 - z1) < eps) return;
        auto a = s.at(z0), b = s.at(z1);
        auto c = t.at(z0), d = t.at(z1);
        ldb t1 = c.x - a.x, t2 = d.x - b.x;
        if (t1 < t2) swap(t1, t2);
        ldb val = z1 - z0;
        if (abs(t1 - t2) > eps) {
            q.push_back({t1, 0, f * val / (t2 - t1)});
            q.push_back({t2, 0, -f * val / (t2 - t1)});
        } else {
            q.push_back({t2, f * val, 0});
        }
    };

    int cc = 0;
    for (const auto& s : {s3, s4}) {
        for (const auto& t : {s1, s2}) {
            cc++;
            int f = cc == 1 || cc == 4 ? -1 : 1;
            ldb lst_z = max(s[0].a.y, t[0].a.y);
            for (int i = 0, j = 0; i < s.size() && j < t.size();) {
                if (s[i].b.y < t[j].a.y) {
                    i++;
                    continue;
                }
                if (t[j].b.y < s[i].a.y) {
                    j++;
                    continue;
                }
                ldb nz = min(s[i].b.y, t[j].b.y);
                update(s[i], t[j], lst_z, nz, f);
                lst_z = nz;
                if (nz == t[j].b.y)
                    j++;
                else
                    i++;
            }
        }
    }
    sort(q.begin(), q.end(), [&](const item& a, const item& b) { return a.t < b.t; });

    vector<poly> ans;
    ldb v0 = 0, v1 = 0, s = 0, ss = 0;
    ldb lt = -1e50;
    ans.push_back({lt, s, v0, v1});
    for (int i = 0; i < q.size(); ++i) {
        auto t = q[i].t;
        auto dt = t - lt;
        ss += s * dt + v0 * dt * dt / 2 + v1 * dt * dt * dt / 6;
        s += v0 * dt + v1 * dt * dt / 2;
        v0 += v1 * dt;
        v0 += q[i].v1, v1 += q[i].v2;
        lt = t;
        ans.push_back({q[i].t, ss, s, v0, v1});
    }
    ans.back().a1 = ans.back().a2 = ans.back().a3 = 0;
    auto query = [&](ldb t) -> ldb {
        auto [lt, a0, a1, a2, a3] = *(--upper_bound(ans.begin(), ans.end(), poly{t, 0, 0, 0}));
        t -= lt;
        return a0 + a1 * t + a2 * t * t / 2 + a3 * t * t * t / 6;
    };

    auto query2 = [&](ldb t) -> ldb {
        auto [lt, a0, a1, a2, a3] = *(--upper_bound(ans.begin(), ans.end(), poly{t, 0, 0, 0}));
        t -= lt;
        return a1 + a2 * t + a3 * t * t / 2;
    };
    int cq;
    cin >> cq;
    for (int i = 0; i < cq; ++i) {
        ldb t1, t2;
        cin >> t1 >> t2;
        ldb result = t1 == t2 ? query2(t1) : (query(t2) - query(t1)) / (t2 - t1);
        printf("%.8LF\n", result * beta);
    }
}

int main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
    cin >> t;
    while (t--) solve();
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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.45000000
1.12500000
2.25000000

result:

ok 3 numbers

Test #2:

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

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.01768958

result:

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

Test #3:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
52.81830481
70.18546919
71.04629333
0.00000000
0.00000000
0.00437583
7.27590435
2.24042406
4.43672518
0.00000000
0.39874735
24.30553792
1.28024232
0.00000000
0.00000000...

result:

ok 100000 numbers

Test #4:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
4.95238095
41.55555556
7.48011207
25.50528069
7.48011207
8.80551284
0.00000000
0.00000000
0.00000000
0.00000000
0.00242541
2.94767657
0.00000000
0.00000000
0.00000000
0.00000000
0.01212703
0.00000000
1.47383828
0.00000000
0...

result:

ok 100000 numbers

Test #5:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
51.20256420
0.00030551
51.24489796
27.54344756
0.00020368
41.40057950
10.31207967
0.00000000
0.00000000
5.53800246
0.00000000
0.00000000
0.00000000
0.01551879
0.9094697...

result:

ok 100000 numbers

Test #6:

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

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.78434692
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
11.19071477
0.00000000
0.00074742
38.31115625
0.00000000
0.00000000
0.00000000
87.50823075
21.89208929
110.01600659
11.63000756
23.80839002
98.53961752
66.46031746
55.55291005
0.00000000
20.83234127
0.00000000
0....

result:

ok 100000 numbers

Test #7:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
108.99283521
5.56525573
5.56525573
49.86435902
0.00000000
142.98614459
0.00000000
79.07237302
62.33044878
17.97600676
0.00000000
36.31873696
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.000...

result:

ok 100000 numbers

Test #8:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
19.57871462
0.00000000
0.00000000
40.19221698
6.69870283
0...

result:

ok 100000 numbers

Test #9:

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

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.12986040
0.00000000
0.02592593
6.12986040
19.98060034
15.23391026
11.08057812
0.00000000
0.00000000
15.23391026
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
25.80540436
30.96648523
0.00000000
0.00000000
0.000000...

result:

ok 100000 numbers

Test #10:

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

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.63741392
0.00000000
0.00000000
2.56572212
0.00000000
0.00000000
1.87681380
0.00000000
0.00000000
0.00000000
0.62560460
0.37536276
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #11:

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

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.00000000
108.52193507
0.00000000
0.00000000
54.26096753
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
220.20000000
31.03053571
0.00000000
0.00000000
23.60489067
0.00000000
0.00000000
21.9371...

result:

ok 100000 numbers

Test #12:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
25.84693878
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0....

result:

ok 100000 numbers

Test #13:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #14:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
13671.17724501
0.00000000
0.00000000
23746.17718673
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0000...

result:

ok 100000 numbers

Test #15:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
1029799.36028680
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
462.99463954
0.0000...

result:

ok 100000 numbers

Test #16:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
1196864.38143310
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
192.18689520
0.00000000
0.00000000
0.00000000
3603.50428503
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
526...

result:

ok 100000 numbers

Test #17:

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

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.00000000
716454.45850988
0.00000000
1074681.68776482
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #18:

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

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
104457.29206843
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
3502974.94080315
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #19:

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

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.00000000
1457170.01110348
942960.62025432
1447882.60059499
1432062.02639415
0.00000000
0.00000000
1369225.69172787
859361.51775527
272620.83925177
0.00000000
0.00000000
0.00000000
5773545.11032660
1569260.95467896
111531.97093675
6765376.85537256
0.00000000
0.00000000
0.00000000
322203.47159506
0....

result:

ok 100000 numbers

Test #20:

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

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.66330876
0.00000000
0.00000000
1358469.75780775
0.00000000
3228392.67551202
1325934.42889145
2777045.03305823
3338493.55017487
1961814.79234260
0.00000000
1243685.58482351
3810.02183583
1528168.33768503
0.00000000
390535.81036917
1040562.36372770
1910536.57430650
1798509.98594931
0.00000000
...

result:

ok 100000 numbers

Test #21:

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

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.84407540
397173.55418942
0.00000000
0.00000000
170724.78969380
0.00000000
284680.04895498
613.98646087
0.00000000
363900.37050995
1001711.55089087
0.00000000
1805.38807875
0.00000000
0.00000000
431073.53072593
0.00000000
1608158.11199267
0.00000000
608176.19644226
0.00000000
0.00000000
17418...

result:

ok 100000 numbers

Test #22:

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

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.00000000
801410.16223780
1098530.62298323
0.00000000
4041049.99403116
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.000000...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 65ms
memory: 4736kb

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #24:

score: 0
Accepted
time: 63ms
memory: 4592kb

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.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.97959184
4498.9...

result:

ok 100000 numbers

Test #25:

score: 0
Accepted
time: 59ms
memory: 4348kb

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.00000000
0.00000000
2069.54152809
1549.84383935
0.00000000
0.00000000
590.32271347
2196.02418164
0.00000000
0.00000000
0.00000000
183.60146648
0.00000000
1328.62597809
0.00000000
0.00000000
1346.38008045
2181.35603271
0.00000000
0.00000000
1562.01116963
0.00000000
0.00000000
0.00000000
0.00000000
...

result:

ok 100000 numbers

Test #26:

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

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.00000000
0.00000000
13309.80493667
0.00000000
0.00000000
0.00000000
0.00000000
9522.14311798
0.00000000
20072.62688794
13269.48000261
22224.33696186
0.00000000
0.00000000
13186.17744714
0.00000000
0.00000000
16304.29041635
0.00000000
0.00000000
0.00000000
0.00000000
18531.29089867
0.00000000
0.000...

result:

ok 100000 numbers

Test #27:

score: 0
Accepted
time: 64ms
memory: 4624kb

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.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
13749.41602072
...

result:

ok 100000 numbers

Test #28:

score: 0
Accepted
time: 62ms
memory: 4640kb

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.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
82574.64650735
...

result:

ok 100000 numbers

Test #29:

score: 0
Accepted
time: 60ms
memory: 4588kb

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #30:

score: 0
Accepted
time: 62ms
memory: 4636kb

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.03931317
6161.77438015
179.16115485
433.03894770
0.00000000
11400.03807693
11330.30620662
2416.38356242
11344.18472284
4888.43514417
1302.48352177
5021.53043620
9386.19108474
1111.50430073
11315.94299151
11358.32982345
13468.38999494
11259.60493853
11216.75764265
9361.66863354
11302.11294519
1...

result:

ok 100000 numbers

Test #31:

score: 0
Accepted
time: 60ms
memory: 4632kb

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #32:

score: 0
Accepted
time: 60ms
memory: 4760kb

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.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
13636.97222222
...

result:

ok 100000 numbers

Test #33:

score: 0
Accepted
time: 104ms
memory: 5352kb

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #34:

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

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.52672852
1997195902.05843269
1996978600.20696289
1996848106.03751211
1959497389.33303928
1997022081.13367476
1997195900.45246094
1985049143.00776367
1971255131.63099825
1955292374.69028342
1959805154.73872166
1972371846.35706665
1997065536.36486328
1997239331.59410645
1997130727.24149805
...

result:

ok 100000 numbers

Test #35:

score: 0
Accepted
time: 110ms
memory: 5356kb

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #36:

score: 0
Accepted
time: 114ms
memory: 5176kb

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.27438930
160510702.01350698
160500143.47854249
168053074.24529198
160584611.04327090
168327556.68780574
170603640.50513958
160595169.54060447
177793598.40054659
169560447.78734239
176699636.06354647
160626844.43051040
160468467.64786344
171993863.33232461
160531819.13988235
168295489.48923...

result:

ok 100000 numbers

Test #37:

score: 0
Accepted
time: 114ms
memory: 5216kb

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.92353182
3364513364.64699832
5701557339.69379558
4745145647.63968677
5701394995.94717235
5701151837.17954111
5701520196.04089624
5540562065.01898099
4373902356.28902840
3409467708.82633521
5076629690.06775458
5701557339.69379563
5701557339.69379559
5701557339.69379563
3395273656.13556509
...

result:

ok 100000 numbers

Test #38:

score: 0
Accepted
time: 49ms
memory: 10296kb

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #39:

score: 0
Accepted
time: 47ms
memory: 6236kb

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.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.0...

result:

ok 100000 numbers

Test #40:

score: 0
Accepted
time: 75ms
memory: 7164kb

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.82091034
3679576489.68372571
3671089348.21309007
3674502015.92054218
3705213758.09809150
3685172897.28190482
3692742780.37903325
3680749261.01860849
3666710875.21550961
3676528921.89034008
3668119007.06418477
3670021327.80890941
3678303905.85788147
3671425975.24440005
3670645930.37275095
...

result:

ok 100000 numbers

Extra Test:

score: 0
Extra Test Passed