QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#636520#6620. Linear Fractional Transformationjty233AC ✓258ms3988kbC++233.6kb2024-10-13 00:15:052024-10-13 00:15:06

Judging History

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

  • [2024-10-13 00:15:06]
  • 评测
  • 测评结果:AC
  • 用时:258ms
  • 内存:3988kb
  • [2024-10-13 00:15:05]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
using i64 = long long;

template<size_t N, size_t M>
struct Matrix{
    const double eps = 1e-9;
    int n, m;
    array<array<double, M>, N> val;
    Matrix(int n, int m){
        this -> n = n;
        this -> m = m;
        for(auto&r : val) r.fill(0);
    }
    Matrix() : Matrix(N, M){}
    array<double, M>& operator [](int x){
        return val[x];
    }

    void print(){
        for(int i=0; i<n; i++){
            for(int j=0; j<m; j++){
                cout << val[i][j] << ' ';
            }
            cout << "&\n";
        }
    }

    void swap(double &x, double &y){
        double temp = x;
        x = y;
        y = temp;
    }

    void swapLine(int x, int y){
        for(int i = 0; i < m; i++) swap(val[x][i], val[y][i]);
    }

    bool GE(void){
        // if(n != m - 1) return false;
        for(int i = 0; i < m-1; i++){
            int maxArg = i;
            for(int j = i + 1; j < n; j++)
                if(std::abs(val[j][i]) > std::abs(val[maxArg][i])) maxArg = j;
            swapLine(maxArg, i);
            if(std::abs(val[i][i]) < eps) return false;
            for(int j = 0; j < n; j++){
                if(i == j) continue;
                double c = val[j][i] / val[i][i];
                for(int k = i; k < m; k++) val[j][k] -= val[i][k] * c;
            }
        }
        for(int i = 0; i < m-1; i++) val[i][m-1] /= val[i][i], val[i][i] = 1.0;
        return true;
    }
};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(10);

    int T; cin >> T;
    while(T--){
        Matrix<6, 7> mx;
        Matrix<6, 5> mx2;
        for(int row=0; row<6; row++){
            double x, y, w1, w2;
            cin >> x >> y >> w1 >> w2;

            mx[row][0] = x;     // a1
            mx[row][1] = -y;    // a2
            mx[row][2] = 1;     // c1
            mx[row][3] = 0;     // c2
            mx[row][4] = -w1;   // d1
            mx[row][5] = w2;    // d2
            mx[row][6] = -w2*y + w1*x;

            mx2[row][0] = x;
            mx2[row][1] = -y;
            mx2[row][2] = 1;
            mx2[row][3] = 0;
            mx2[row][4] = w1;

            row++;

            mx[row][0] = y;     // a1
            mx[row][1] = x;     // a2
            mx[row][2] = 0;     // c1
            mx[row][3] = 1;     // c2
            mx[row][4] = -w2;   // d1
            mx[row][5] = -w1;   // d2
            mx[row][6] = w1*y + w2*x;

            mx2[row][0] = y;
            mx2[row][1] = x;
            mx2[row][2] = 0;
            mx2[row][3] = 1;
            mx2[row][4] = w2;
        };

        double x, y; cin >> x >> y;
        // mx.print();
        if(mx.GE()){
            auto a1 = mx[0][6];
            auto a2 = mx[1][6];
            auto c1 = mx[2][6];
            auto c2 = mx[3][6];
            auto d1 = mx[4][6];
            auto d2 = mx[5][6];

            // printf("%lf %lf %lf %lf %lf %lf\n", a1, a2, c1, c2, d1, d2);
            
            double div = (x+d1)*(x+d1) + (y+d2)*(y+d2);

            cout << ((a1*x-a2*y+c1)*(x+d1) + (a2*x+a1*y+c2)*(y+d2)) / div << ' ';
            cout << ((a2*x+a1*y+c2)*(x+d1) - (a1*x-a2*y+c1)*(y+d2)) / div << '\n';
        }else{
            mx2.GE();
            auto a1 = mx2[0][4];
            auto a2 = mx2[1][4];
            auto c1 = mx2[2][4];
            auto c2 = mx2[3][4];

            // printf("%lf %lf %lf %lf\n", a1, a2, c1, c2);

            cout << (a1*x-a2*y+c1) << ' ';
            cout << (a1*y+a2*x+c2) << '\n';
        }
    }

    return 0;
}


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

详细

Test #1:

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

input:

2
-1 0 0 -1
0 1 -1 0
1 0 0 1
0 -1
-1 0 -1 0
0 1 0 -1
1 0 1 0
0 -1

output:

1.0000000000 0.0000000000
0.0000000000 1.0000000000

result:

ok 4 numbers

Test #2:

score: 0
Accepted
time: 215ms
memory: 3872kb

input:

100000
0 0 -1 1
1 1 1 0
1 0 1 -1
-1 0
-1 -1 -1 1
1 -1 1 -1
-1 0 1 0
-1 -1
-1 -1 0 -1
-1 1 -1 -1
0 -1 0 0
1 1
1 0 0 -1
0 0 0 0
-1 -1 1 0
1 1
-1 -1 0 -1
0 1 1 -1
1 0 -1 -1
1 -1
0 1 1 -1
1 0 1 0
0 -1 0 1
-1 -1
1 1 -1 1
0 0 -1 -1
0 1 0 1
1 0
1 1 1 -1
0 1 -1 -1
1 0 -1 0
1 -1
1 0 -1 1
-1 -1 1 0
0 -1 0 1
0...

output:

1.0000000000 1.6666666667
-1.0000000000 1.0000000000
-1.5000000000 -0.5000000000
0.3333333333 -0.6666666667
-0.3846153846 -0.9230769231
-1.0000000000 0.0000000000
-1.5000000000 0.5000000000
-0.8536585366 -0.3170731707
-1.3333333333 0.3333333333
0.1724137931 -0.0689655172
-1.0000000000 -1.0000000000
...

result:

ok 200000 numbers

Test #3:

score: 0
Accepted
time: 221ms
memory: 3732kb

input:

100000
2 -2 -1 -1
-1 2 2 -2
-1 -1 -2 2
2 0
-1 1 0 -2
2 -1 -2 1
2 -2 2 1
2 2
2 2 -2 -1
-2 1 2 1
1 1 -2 -2
1 -2
-2 -1 0 1
2 -1 1 1
1 0 -2 0
-1 0
1 2 -2 0
2 0 0 -1
-1 1 -2 -1
-1 2
1 0 0 -1
2 -1 -2 2
1 -2 -1 1
1 2
2 1 -2 -1
-2 2 0 -1
0 1 -1 1
1 -2
2 2 1 1
-1 1 2 2
-1 2 -1 -2
0 0
2 -1 -1 -2
1 -1 -2 1
0 1...

output:

-0.2687277051 -0.9821640904
-0.5573159366 -2.6905871389
-0.6035502959 -1.2485207101
-0.1621621622 0.9729729730
-2.2307692308 -0.8461538462
0.5294117647 0.8823529412
-2.0000000000 -3.0000000000
1.3123732252 1.3367139959
-2.0000000000 1.0000000000
-3.5000000000 -7.5000000000
0.9297297297 0.9783783784
...

result:

ok 200000 numbers

Test #4:

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

input:

100000
-2 -3 1 1
0 -3 3 3
-1 1 0 3
-1 -2
-3 1 -3 -1
0 -1 2 3
-2 0 -2 1
2 3
-2 1 3 -1
3 -1 3 -2
2 1 0 -3
-3 -1
-1 2 0 3
1 1 -3 -3
-1 -3 2 -3
2 1
0 -3 1 2
-3 -2 0 3
-2 2 2 -3
2 -3
-3 0 -3 2
0 0 -3 1
0 1 0 3
3 0
-3 -3 0 -3
1 1 3 -2
1 0 2 0
-1 1
-3 1 -3 2
-2 3 2 3
0 2 -2 -3
-1 -1
1 -2 1 1
1 1 -2 -3
-1 0...

output:

1.3135135135 2.3189189189
11.3333333333 -22.3333333333
3.0412607450 -1.1885386819
-1.4117647059 -2.6470588235
1.0315962249 1.5752974969
-3.6666666667 2.0000000000
1.3333333333 -5.3333333333
-4.3333333333 -0.0000000000
5.0350194553 -2.4396887160
-7.0000000000 -1.0000000000
-3.5777777778 0.7333333333
...

result:

ok 200000 numbers

Test #5:

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

input:

100000
-4 -1 -3 1
-3 -4 -2 -2
-1 2 -4 -4
-1 2
1 0 1 4
-3 0 4 -4
-1 -2 -3 -1
3 4
-2 3 2 3
-3 2 4 0
2 -3 -2 0
1 -4
1 1 1 -3
3 1 -4 1
2 -3 -1 4
3 4
3 -2 3 1
4 -3 1 2
3 -1 -2 0
2 0
-2 -4 3 -2
2 1 3 1
-1 1 -1 -1
-4 -2
2 4 0 -2
-1 -2 -1 -4
0 -1 1 -3
1 3
-2 -2 -4 1
4 3 0 2
-2 -1 0 4
0 2
-3 0 -3 -1
-1 1 -4 ...

output:

-4.0000000000 -4.0000000000
2.4723997676 1.4450900639
-1.8509923002 -0.2745906084
-8.8082984883 4.6330009649
-1.1719745223 2.8152866242
2.7857142857 -2.8571428571
0.0524515393 -2.0798175599
0.0497978981 2.2103476152
-3.4613861386 -0.1861386139
1.2540238695 4.0170809154
0.0000000000 1.0000000000
3.05...

result:

ok 200000 numbers

Test #6:

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

input:

100000
2 -1 -3 4
3 5 1 -5
-1 -2 0 -4
5 1
-3 2 1 0
3 -3 2 -5
-4 -4 2 1
3 3
3 -3 2 -2
3 5 -2 5
2 -3 0 3
-2 -1
-4 2 1 1
-2 5 1 5
4 -3 2 5
-1 2
-4 4 -5 2
-3 -1 5 5
-5 3 4 -4
-1 0
5 -1 -1 -3
2 3 -3 -5
-4 -1 -5 2
5 2
-1 -4 -2 2
-5 5 -1 2
-3 4 -3 -1
-1 -1
1 -3 -1 -3
-5 -3 -4 0
-2 -1 -4 2
0 4
0 -4 -4 -2
-4 ...

output:

1.8163546968 -4.9458293798
0.9461270715 -1.1164735830
-1.5424936777 4.4738294122
1.5775401070 4.4010695187
4.0302850356 5.6217339667
-1.9257160361 -3.6702404656
-2.0893365788 1.9394064944
-6.3911671924 -0.5930599369
-4.0000000000 -2.0000000000
2.3333333333 -3.3333333333
2.8926126994 -5.4734935993
6....

result:

ok 200000 numbers

Test #7:

score: 0
Accepted
time: 219ms
memory: 3872kb

input:

100000
-6 6 -2 4
-5 5 3 -6
-1 4 -6 -4
1 5
-4 -3 -4 5
6 -3 1 4
-3 5 4 3
-1 5
5 -2 -5 2
-2 3 5 5
2 2 -3 0
2 4
-1 -6 2 1
-6 -5 4 -4
-5 -6 3 3
1 5
-3 5 1 1
5 5 -4 0
-1 4 6 -3
2 -5
3 1 -2 -4
4 3 3 -3
-5 -6 2 -2
2 0
4 -4 5 -4
6 3 0 1
3 4 -2 -1
6 -4
-5 6 -6 -3
-3 2 3 3
5 -3 -5 -6
2 -2
-3 5 3 -5
0 3 4 3
1 -...

output:

-6.3099068586 -3.3073666384
3.3657264470 3.6426665867
-3.7955729588 -2.4874275913
1.7508367423 0.5444403124
-2.1496108468 -0.9076483045
0.8726008765 -1.8836330663
6.0928635414 -2.2293221857
-4.6679962722 -6.4819889041
-3.1337439507 -5.7857457105
4.5670852611 5.2485128883
2.5681492109 -4.7604017217
-...

result:

ok 200000 numbers

Test #8:

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

input:

100000
-2 -1 -3 0
4 -4 -2 6
2 -1 -7 0
0 -6
-1 0 1 -2
-2 -3 2 -5
3 -2 -1 5
6 -1
1 5 -6 7
-6 -3 -3 2
7 -2 -3 -3
-3 -4
1 7 -5 -2
-5 -4 -5 -4
2 0 1 6
7 4
1 -3 6 -7
-6 -6 1 -5
4 -2 1 1
-3 -3
-5 0 2 7
-2 2 -5 1
3 -4 -1 6
6 4
-7 4 3 -2
-5 4 7 -7
0 2 0 2
2 -3
-7 1 4 -6
0 5 2 -6
4 -2 4 -5
-2 3
1 -7 -1 -7
7 -...

output:

-2.1314225795 2.0300594198
-3.8938700823 0.7511436414
-2.3984704677 1.6373642882
-6.1395898073 -1.6054692356
1.8664047151 -5.2121807466
-1.8015500969 6.4100881305
0.5923650062 0.9645879413
3.2487804878 -5.9609756098
1.8906007652 -0.3502223141
3.4157395640 -0.4183009092
2.2687444882 6.1972092296
-3.2...

result:

ok 200000 numbers

Test #9:

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

input:

100000
6 1 3 5
7 -1 2 0
-3 -6 0 3
-6 -8
4 8 -4 7
-2 -5 -2 7
-2 -8 -4 -5
-7 -8
4 -7 -1 -5
2 5 -7 0
-4 0 -7 -5
-7 1
8 2 2 0
1 6 -6 3
0 -7 5 0
2 -5
-7 6 8 5
-5 3 -8 8
-5 0 -1 -8
5 -4
-1 6 -5 8
6 -7 4 5
-4 3 -6 -6
3 2
5 -2 1 5
6 -6 -4 0
3 5 -6 3
-8 2
-4 3 2 -8
6 0 3 7
-4 -8 -4 2
-5 0
-7 3 -3 -3
1 -8 -6 ...

output:

-0.1205245048 3.0345019994
-4.0059077408 5.5842099217
-8.4299348257 -5.9873391896
4.6022926049 -0.5428560795
3.4647058824 -2.0411764706
0.6300728959 5.1122229357
-5.2690355330 2.2335025381
-4.7322063459 -6.2427600884
-2.7830236062 -0.2134605726
9.1611001965 90.5088408644
0.8865493297 -8.0308367989
9...

result:

ok 200000 numbers

Test #10:

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

input:

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

output:

-0.9408056715 5.3635300075
-0.4270894044 -3.3653106423
6.2053176098 -8.4636624705
6.1588895452 -2.3821618429
-1.6295824128 11.3719231856
-9.7059015088 3.3532944965
9.2090754123 10.5674799469
-10.6878993993 -2.0794649380
1.8500646378 -8.3639353459
3.3192356373 -4.3509091470
-4.8357050453 -8.081500646...

result:

ok 200000 numbers

Test #11:

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

input:

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

output:

9.3979320005 -4.7255858262
-4.6109351396 -0.7536182447
1.8139717281 -2.4735203828
8.0322701128 -10.8807051617
0.6682258603 -4.3969261610
3.4267656837 -9.9962914883
2.3869553949 1.9323088993
9.1052601144 -6.9921078623
-4.9022560508 5.5595225057
-3.0207612457 4.2110726644
13.4086518754 -1.7388417043
7...

result:

ok 200000 numbers

Test #12:

score: 0
Accepted
time: 230ms
memory: 3916kb

input:

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

output:

-9.6415629648 -7.8393707821
-0.6123033832 -0.7438379446
8.6117867747 -1.4856454278
5.1248893763 3.0488861995
-7.6825343167 -0.4304146157
2.6631729553 -7.1168895987
-8.1164464773 5.0613646817
-8.4757931445 1.6513359097
-7.8688200396 -1.3968358603
2.3382969495 1.4720977302
-7.0755377053 -3.5470503496
...

result:

ok 200000 numbers

Test #13:

score: 0
Accepted
time: 234ms
memory: 3916kb

input:

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

output:

11.0138821323 14.4851410470
8.7673930605 2.1034288540
-1.1865622019 7.6447136373
-3.7692307692 -0.1538461538
-9.1659001804 7.0934578061
-4.5838973633 6.6852802046
-5.5610619469 -7.1840707965
2.5392203332 -3.1163575508
-4.8462265179 -3.6120417136
6.3555454674 4.5625546175
8.7120313022 7.4691693825
-4...

result:

ok 200000 numbers

Test #14:

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

input:

100000
12 -13 -8 -3
1 -5 8 -7
-3 2 -6 12
-13 8
2 11 -7 6
-13 -11 8 -13
-7 8 3 13
-5 1
-3 -11 -9 0
-4 11 6 9
6 9 -12 13
11 13
-2 -5 -3 -6
5 -11 -5 -3
-12 -13 -10 6
-3 3
4 -13 -3 0
13 -4 -12 13
-2 -2 4 -6
-3 12
11 -4 0 13
-1 2 3 8
-6 12 -8 -4
-13 -2
-12 -4 10 -2
-10 -13 3 13
-7 -10 -7 -4
-7 13
8 -12 7...

output:

-7.3353608723 5.1107797350
14.8068455517 74.7866446211
-8.9494236146 9.2358648185
-6.6920562452 -6.8437093368
9.6666747824 1.0978740002
12.9102653701 15.6594317206
16.6450820832 -4.3134715668
6.0340020162 -7.8168281880
-7.4490330247 3.8943945336
-11.0756615913 7.0781451140
13.1838885230 -1.164269125...

result:

ok 200000 numbers

Test #15:

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

input:

100000
-10 13 0 3
14 13 11 -3
7 4 -1 -8
-13 9
-7 1 -8 -8
-6 -12 -14 11
10 12 -13 -2
-8 14
7 6 6 -11
-12 -11 -9 4
-12 12 -12 1
10 -6
-14 4 -5 -14
14 -12 -3 11
2 11 -8 1
10 1
-4 -14 -4 -4
-6 -2 -4 14
0 -5 -6 -2
3 1
-4 12 -6 1
12 2 9 5
-13 -6 -14 4
-6 8
-2 2 -1 -10
14 -9 -5 0
4 -14 -3 -7
-8 -10
0 13 10...

output:

-1.1879201264 3.4559804412
-13.7593384458 -4.6336360745
-3.4601915966 4.1802261252
-4.7261092420 5.7999717424
-4.2721636027 -0.9043837703
-7.7295182917 0.0120557165
-1.5277358083 -8.3034750701
9.0169260776 -7.5263320824
-3.7441287183 -8.7251396872
-4.7714179397 -0.2202367423
-5.7494841516 -11.900211...

result:

ok 200000 numbers

Test #16:

score: 0
Accepted
time: 242ms
memory: 3856kb

input:

100000
14 -14 -7 -15
-10 -2 -5 -5
-9 12 15 -12
-1 14
-8 -9 15 -9
-13 6 7 9
12 10 9 1
6 -11
-11 9 -6 2
-3 11 -8 3
10 -2 -8 -13
-11 -13
-9 -12 14 2
0 1 4 -3
5 10 14 3
5 7
11 -10 0 -11
6 4 11 -2
-1 -4 4 -12
6 -7
1 -3 -2 -7
12 -11 -6 8
15 -1 12 -1
-10 9
-10 -6 4 4
11 13 14 -11
-10 12 -10 11
-12 -7
14 6 ...

output:

4.4286580171 -18.1269915299
10.4196135977 -2.0472253590
-3.2637080633 -0.6659637610
13.8345577055 3.1765046772
0.8113017244 -12.9620330667
0.7172831586 -3.8431117927
3.4354805878 3.5218759794
-1.9419676744 14.5766594568
-14.9482809152 10.9014010421
-4.2443226028 -3.0725242027
-6.3623990204 9.1186119...

result:

ok 200000 numbers

Test #17:

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

input:

100000
9 5 -15 2
-2 -11 5 6
-13 -10 15 -1
-9 6
16 -7 -12 -4
13 -9 -12 -10
-16 -10 -11 13
16 -14
-15 -11 -2 -1
-14 2 -1 -2
-15 5 -7 6
10 3
-12 -6 -14 3
-16 1 9 13
-7 -6 -8 -3
-16 3
5 8 9 6
-15 10 -4 -14
7 -13 -3 -9
-8 11
11 -5 -8 -3
-8 15 -3 14
3 -8 10 11
4 -9
-7 11 -14 11
16 -7 11 -15
12 14 14 -7
2 ...

output:

-0.9827293970 -15.5018449412
-3.6651982094 -3.7802956454
-2.3278657416 -1.0479884190
11.3026779341 7.1549195238
-4.9091483836 -16.2735437058
9.0089454156 8.2587801618
4.0698242431 -13.3801256740
4.9627572684 -9.5100748638
-2.9673143647 -8.4075649883
-7.5857048435 -1.9559066947
-4.2958398723 -11.3389...

result:

ok 200000 numbers

Test #18:

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

input:

100000
1 12 -13 4
6 -2 -14 -2
14 -2 2 -9
-9 4
14 -16 7 16
16 -4 11 5
13 -16 -2 -16
-10 -6
14 -15 -17 -15
-11 17 -9 3
-4 -13 -1 1
4 -14
9 -11 -16 8
-2 -11 -10 9
-9 -13 13 12
1 17
17 13 10 13
14 -13 6 4
3 15 14 12
10 -13
2 -8 -5 -14
-5 9 9 2
1 -10 -3 -11
-2 8
7 -8 -1 -15
15 5 10 4
-14 4 6 6
-2 3
1 -12...

output:

-15.1006276864 3.5738687835
10.4612745744 4.5186549663
8.4175687322 -6.2705565333
-17.9074378198 3.2326537306
7.0606989512 2.1184129487
10.4833407778 4.0233084968
5.8751375878 4.1564600232
11.9167475257 10.8983116631
-14.8224296461 4.3018174825
3.7885735007 -5.4427000194
6.6472855474 5.1338705063
1....

result:

ok 200000 numbers

Test #19:

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

input:

100000
15 6 5 12
-6 -6 -4 -12
-7 8 4 3
-11 -5
-1 10 -2 -2
3 -2 -4 14
-17 13 -12 -2
10 0
-6 -16 -13 -5
0 4 9 -13
11 16 -10 -8
-1 0
-9 13 -12 -4
12 -18 -7 8
-6 11 -8 -3
-16 0
11 5 15 10
14 -9 13 -18
-13 -14 5 -4
-15 13
8 -18 -17 16
-3 1 3 -11
11 17 14 15
0 11
15 -8 14 11
-8 12 -14 18
4 12 11 7
-16 3
-...

output:

-3.3062037116 -2.9154175781
-5.4102632951 8.0903132058
-13.0367304990 6.6437188107
0.9676841864 29.4671563002
4.3154805369 0.2558763782
14.4304470721 2.6699292644
16.5749483290 18.6163255305
-4.4343304074 11.1478796500
-1.5485290496 10.4218898244
0.7086917651 -8.6717413902
0.7730240198 8.4028899404
...

result:

ok 200000 numbers

Test #20:

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

input:

100000
-11 -2 12 -10
-7 -13 2 -5
-15 -6 -14 -16
12 -2
3 1 6 -16
-1 -5 -14 -18
0 3 -7 -14
-7 17
16 17 -10 13
-3 18 -18 5
-15 1 -16 12
19 0
-15 -18 13 -9
-5 3 -14 9
-6 9 10 15
-4 14
10 -19 -9 14
-13 6 -12 -15
10 2 -6 7
16 -1
14 12 -15 11
-2 -17 11 0
18 16 -17 -13
-6 4
-16 -18 3 -5
15 -10 -12 -1
-18 -1...

output:

3.6988732666 -7.6935395746
-12.2048481471 -12.0987461688
-12.9611170162 13.9207040909
11.8525023858 7.5362806539
-7.6968750148 8.5091246154
6.7980572603 1.4326909488
-11.9046248421 -2.0377105758
-28.2533143447 -5.5334766983
-8.1299819087 14.7049661470
-15.1662632218 -8.0219165912
-54.0203429419 15.0...

result:

ok 200000 numbers

Test #21:

score: 0
Accepted
time: 244ms
memory: 3872kb

input:

100000
9 -1 10 -3
-12 3 10 -10
-7 20 -5 -20
-5 -3
-12 8 7 0
-8 15 0 -4
-6 -3 -11 8
4 11
16 6 3 -12
20 -14 11 -5
-6 10 17 2
-4 -13
8 14 -14 -13
10 4 4 -9
4 -2 -6 -16
-11 1
1 -1 13 9
0 15 -6 3
16 -2 12 8
11 -14
1 -11 -4 16
-20 1 -12 10
16 -13 2 -18
-7 17
-18 3 -4 15
-17 8 4 -11
2 -16 -16 17
-18 10
12 ...

output:

10.2988255017 -6.9529228974
-5.1128470308 -2.0828132925
14.1856977125 -3.2369030392
-9.0688105135 -16.0652328794
11.9089256766 8.5881489977
-15.2195702280 9.7605765413
-40.2087951376 -89.0965319986
4.7263679496 -18.5697077584
-9.0985182181 -4.3111484247
7.6594498501 1.9955509119
-5.3312714867 11.461...

result:

ok 200000 numbers

Test #22:

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

input:

100000
-13 -26 -29 14
28 -9 -14 3
-25 1 -19 30
2 14
-13 -6 5 5
-8 11 -29 28
22 -9 -7 16
-23 20
30 19 2 -10
-2 15 0 -9
1 4 -16 -4
10 1
-7 -27 -23 -6
-18 -9 -2 -24
-3 30 23 28
-7 -8
25 9 3 -22
-8 -26 0 14
-19 -23 29 6
12 29
-7 17 -4 -16
-4 14 24 -25
-13 -22 -24 -16
22 11
-4 -18 17 11
-3 -21 -16 -30
21...

output:

-6.8010533994 15.4866788662
-3.1229966868 31.5103111756
3.7008407579 -12.2986572970
-25.8479710940 -48.9352008413
6.9500776727 -23.0667379871
-25.6726839532 -9.1977372535
-28.2307499422 -2.7584798432
13.5954737835 -5.6295044068
27.7920833554 18.7959608323
44.0508944292 -27.9031399051
21.4624254188 5...

result:

ok 200000 numbers

Test #23:

score: 0
Accepted
time: 253ms
memory: 3856kb

input:

100000
37 12 -7 8
-26 -32 -10 10
37 -35 -33 30
-8 -4
-16 -19 -35 30
40 37 -3 -17
-12 -15 -4 14
26 4
19 13 -3 38
33 -2 0 -40
19 31 12 -20
10 -10
17 -7 -34 -3
-25 34 -15 10
15 37 -38 38
14 7
-29 -7 -24 11
-26 19 -20 38
-19 -34 -6 6
34 36
-29 31 17 -38
-6 -32 -24 34
-31 -14 21 -8
9 -23
10 3 -33 14
-23 ...

output:

-9.5456691869 8.8398722126
-3.6145529090 -14.2896592525
15.6940168880 -44.2333001343
-39.8053929384 -11.4441562447
2.9208650414 26.5810864597
-47.8843003423 -14.7628373622
17.8630907015 19.0181540675
-22.0554016214 13.3422839498
-2.8329510440 -19.9087163137
-17.4029268871 -32.8755118953
-42.43908421...

result:

ok 200000 numbers

Test #24:

score: 0
Accepted
time: 250ms
memory: 3736kb

input:

100000
-32 -37 -23 -22
43 34 -4 41
-50 -18 30 41
43 47
-39 -20 49 -5
-20 -35 9 18
-16 1 48 -39
-41 -7
-31 -34 49 -34
-27 39 -46 17
-1 -34 -39 -47
-49 6
-45 -3 -47 -3
-23 -44 46 29
40 -21 19 33
-9 -2
39 43 -4 22
-45 29 -7 -14
-41 38 -1 -38
-49 -20
28 -30 8 -11
43 -30 -30 -6
-8 30 22 19
13 -4
37 -15 -...

output:

-3.2436564954 40.8478115427
55.3831263071 -15.5380494779
-31.1052360008 40.3393367748
12.0488148957 16.9285628739
-4.9557193498 7.7092385798
29.2632428496 10.1494710270
-55.5973516880 20.6988057600
103.5621924714 30.6098638285
-1.8826496883 -17.4892826788
14.2366296586 38.3991045449
23.0167096858 -3...

result:

ok 200000 numbers

Test #25:

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

input:

100000
22 -47 -50 24
-39 -52 -47 -34
-30 -15 -22 -12
-46 26
-5 -60 -25 -32
-48 -29 -1 10
30 15 -12 -37
44 -19
-28 3 -17 42
-39 -21 -56 22
15 36 30 53
-49 40
-44 -43 13 18
-43 -48 49 -47
-14 -9 -59 -53
-10 24
-17 59 29 -50
-34 -27 9 -50
57 54 21 31
6 -37
-44 22 -37 -11
47 9 -44 -39
28 50 47 16
40 23
...

output:

-34.2132439151 -5.7823189187
-15.5863005669 -36.7995556858
-3.6438924388 81.5467127578
-52.4711156559 -53.0589482721
2.1449398710 -50.4644188512
-34.2439613734 -50.8099035627
-41.9991251725 -47.0001782868
-38.5963919881 46.3920269342
-16.1832285555 0.9361770743
20.1882456019 30.1414273745
24.0719629...

result:

ok 200000 numbers

Test #26:

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

input:

100000
43 -29 -20 -44
27 -41 -50 52
42 24 -22 12
60 -42
15 60 25 -40
7 -67 44 65
59 59 -37 10
-59 46
-60 -13 -63 -67
16 -20 -68 -28
-58 39 -21 19
-38 -42
20 -45 -33 17
60 -36 62 -67
-11 -63 -12 -17
-24 55
14 38 -5 -15
61 34 -45 36
5 -54 -66 50
1 7
59 15 42 -56
-47 4 13 56
54 -38 62 -41
-27 -3
15 -28...

output:

8.0324157112 14.3686984638
111.9630396439 29.3910423141
-65.7219929755 -42.7512840273
-11.2725219738 -43.5692583585
-78.2486739898 88.7938790007
65.6274230038 144.6077607933
13.6864285549 -47.2868121972
-95.7145445659 -25.8238254043
-85.1978592101 -76.4080630794
-24.2420764739 40.3078989505
-45.0156...

result:

ok 200000 numbers

Test #27:

score: 0
Accepted
time: 256ms
memory: 3872kb

input:

100000
-62 -2 80 21
8 -52 -41 -9
-23 18 59 -36
80 64
45 65 -5 -60
-34 -15 -60 -22
9 -10 42 53
5 71
59 7 11 37
-58 12 35 -15
-45 -63 58 -80
62 -27
36 65 61 -38
73 -64 13 79
-9 -24 -71 -30
59 52
59 -16 -29 -75
-17 21 32 60
-51 36 22 -69
66 -63
56 -75 -75 70
-34 -13 -55 8
-11 -24 -70 5
-19 -73
22 -47 5...

output:

20.1424860203 -154.5150753777
-16.3678949053 -67.4062101508
-0.0395883862 58.9641894320
81.9590844718 -24.7956540921
-23.8172566147 -80.2286431007
-65.5531510096 31.2150009809
-35.0545910608 -14.9018946302
76.9426031576 39.1894858994
433.5283830999 107.7863566122
5.5456769424 60.8640655408
25.244188...

result:

ok 200000 numbers

Test #28:

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

input:

100000
-88 -48 -22 59
-77 74 -11 44
-88 -47 -90 -14
81 -79
57 23 -90 -55
18 61 -34 54
76 68 -37 33
-82 11
-5 37 -27 -86
-71 -53 74 15
-21 47 74 -83
-46 12
-30 -58 6 2
-28 2 -33 7
-22 -80 -84 -61
6 24
-19 -69 -87 34
54 82 66 48
-39 -63 -41 -29
-25 -89
47 47 16 21
88 -39 41 -24
86 -31 -69 -15
-67 47
-...

output:

-10.9913036137 44.1907823975
-17.6718972908 47.9601836811
64.3045698762 -11.2742340664
-37.3204880213 7.5076472568
-32.9484783351 34.3500738973
18.3902859144 20.1873850501
13.4336403273 -87.9002070540
61.2977417912 -58.1231337481
-74.5295960039 3.8709421312
-53.0573954924 54.1815408477
-87.764842821...

result:

ok 200000 numbers

Test #29:

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

input:

100000
53 7 91 -58
86 -8 -4 -97
4 45 -61 82
-84 57
87 -48 -23 92
98 27 19 18
-51 -65 -76 -61
-64 -43
-42 42 -29 -59
-82 29 94 68
90 -79 22 -82
-54 -8
69 -61 -7 -64
25 26 -17 -18
35 48 15 -36
41 91
-85 7 -29 27
95 6 32 -85
88 44 75 -83
67 55
81 27 5 -26
2 -9 67 71
-12 88 -47 35
45 -95
8 45 15 -20
57 ...

output:

-69.7497762287 10.2951181611
-59.2466139265 -64.0947582114
19.0464314334 -138.3947304362
17.1089082459 -57.8832580982
89.5603827214 -52.9025631825
23.0494973864 22.1095873893
23.2426666608 -23.8759873456
15.9345242205 31.5133322221
-73.6976892456 -2.9864124953
62.5243449785 -24.1006486497
-12.750200...

result:

ok 200000 numbers