QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#374788#4370. Road TimesInfinityNSAC ✓252ms4628kbC++144.8kb2024-04-02 18:13:582024-04-02 18:14:00

Judging History

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

  • [2024-04-02 18:14:00]
  • 评测
  • 测评结果:AC
  • 用时:252ms
  • 内存:4628kb
  • [2024-04-02 18:13:58]
  • 提交

answer

#include<bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define sz(x) (int)(x).size()

using namespace std;
typedef double T; // long double , Rational , double + mod<P>...
typedef vector<T> vd;
typedef vector<vd> vvd;
typedef vector<int> vi;
const T eps = 1e-8, inf = 1/.0;
#define MP make_pair
#define ltj(X) if(s == -1 || MP(X[j],N[j]) < MP(X[s],N[s])) s=j
struct LPSolver {
    int m, n;
    vi N, B;
    vvd D;
    LPSolver(const vvd& A, const vd& b, const vd& c) : m(sz(b)), n(sz(c)), N(n+1), B(m), D(m+2, vd(n+2)) {
        rep(i,0,m) rep(j,0,n) D[i][j] = A[i][j];
        rep(i,0,m) { B[i] = n+i; D[i][n] = -1; D[i][n+1] = b[i];}
        rep(j,0,n) { N[j] = j; D[m][j] = -c[j]; }
        N[n] = -1; D[m+1][n] = 1;
    }
    void pivot(int r, int s) {
        T *a = D[r].data(), inv = 1 / a[s];
        rep(i,0,m+2) if (i != r && abs(D[i][s]) > eps) {
            T *b = D[i].data(), inv2 = b[s] * inv;
            rep(j,0,n+2) b[j] -= a[j] * inv2;
            b[s] = a[s] * inv2;
        }
        rep(j,0,n+2) if (j != s) D[r][j] *= inv;
        rep(i,0,m+2) if (i != r) D[i][s] *= -inv;
        D[r][s] = inv;
        swap(B[r], N[s]);
    }
    bool simplex(int phase) {
        int x = m + phase - 1;
        for (;;) {
            int s = -1;
            rep(j,0,n+1) if (N[j] != -phase) ltj(D[x]);
            if (D[x][s] >= -eps) return true;
            int r = -1;
            rep(i,0,m) {
            if (D[i][s] <= eps) continue;
            if (r == -1 || MP(D[i][n+1] / D[i][s], B[i])
            < MP(D[r][n+1] / D[r][s], B[r])) r = i;
            }
            if (r == -1) return false;
            pivot(r, s);
        }
    }
    T solve(vd &x) {
        int r = 0;
        rep(i,1,m) if (D[i][n+1] < D[r][n+1]) r = i;
        if (D[r][n+1] < -eps) {
        pivot(r, n);
        if (!simplex(2) || D[m+1][n+1] < -eps) return -inf;
        rep(i,0,m) if (B[i] == -1) {
        int s = 0;
        rep(j,1,n+1) ltj(D[i]);
        pivot(i, s);
        }
        }
        bool ok = simplex(1); x = vd(n);
        rep(i,0,m) if (B[i] < n) x[B[i]] = D[i][n+1];
        return ok ? D[m][n+1] : inf;
    }
};
const int N=31;
int dist[N][N],roadInd[N][N],n;
vector<pair<int,int>> roads;
vector<int> roadInds(int s,int t){
    vector<int> d(n,INT_MAX);
    vector<int> par(n);
    d[s]=0;
    par[s]=s;
    priority_queue<pair<int,int>> q;
    q.push({d[s],s});
    while(sz(q)){
        auto tr=q.top();
        q.pop();
        if(tr.f!=d[tr.s])continue;
        for(int i=0;i<n;i++){
            if(roadInd[tr.s][i]!=-1){
                int nd=d[tr.s]+dist[tr.s][i];
                if(nd<d[i]){
                    d[i]=nd;
                    par[i]=roadInd[tr.s][i];
                    q.push({d[i],i});
                }
            }
        }
    }
    assert(d[t]!=INT_MAX);
    vector<int> ans;
    while(t!=s){
        ans.pb(par[t]);
        t=roads[par[t]].f;
    }
    return ans;
}
int main(){
    scanf("%i",&n);
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            scanf("%i",&dist[i][j]);
            if(dist[i][j]>0){
                roads.pb({i,j});
                roadInd[i][j]=sz(roads)-1;
            }
            else{
                roadInd[i][j]=-1;
            }
        }
    }
    vvd A;
    vd B;
    int m=sz(roads);
    for(int i=0;i<m;i++){
        vd t;
        for(int j=0;j<m;j++){
            if(i!=j)t.pb(0);
            else t.pb(1);
        }
        A.pb(t);
        B.pb(dist[roads[i].f][roads[i].s]);
    }
    int r;
    scanf("%i",&r);
    for(int i=0;i<r;i++){
        int s,t,d;
        scanf("%i %i %i",&s,&t,&d);
        vector<int> rd=roadInds(s,t);
        for(auto p:rd){
            d-=dist[roads[p].f][roads[p].s];
        }
        assert(d>=0);
        vd tpos,tneg;
        for(int j=0;j<m;j++){
            bool in=0;
            for(auto p:rd)if(p==j)in=1;
            if(in)tpos.pb(1),tneg.pb(-1);
            else tpos.pb(0),tneg.pb(0);
        }
        A.pb(tpos);
        B.pb(d);
        A.pb(tneg);
        B.pb(-d);
    }
    int q;
    scanf("%i",&q);
    for(int i=0;i<q;i++){
        int s,t;
        scanf("%i %i",&s,&t);
        vd cmn,cmx,xmn,xmx;
        vector<int> rd=roadInds(s,t);
        int d=0;
        for(auto p:rd){
            d+=dist[roads[p].f][roads[p].s];
        }
        for(int j=0;j<m;j++){
            bool in=0;
            for(auto p:rd)if(p==j)in=1;
            if(in)cmx.pb(1),cmn.pb(-1);
            else cmx.pb(0),cmn.pb(0);
        }
        T ansMn = LPSolver(A,B,cmn).solve(xmn);
        T ansMx = LPSolver(A,B,cmx).solve(xmx);
        printf("%i %i %.10lf %.10lf\n",s,t,d-ansMn,d+ansMx);
    }
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
0 50 -1
55 0 40
-1 40 0
1
0 2 120
3
0 1
1 2
1 0

output:

0 1 50.0000000000 80.0000000000
1 2 40.0000000000 70.0000000000
1 0 55.0000000000 110.0000000000

result:

ok 12 numbers

Test #2:

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

input:

3
0 50 -1
55 0 40
-1 40 0
1
0 2 90
3
0 1
1 2
1 0

output:

0 1 50.0000000000 50.0000000000
1 2 40.0000000000 40.0000000000
1 0 55.0000000000 110.0000000000

result:

ok 12 numbers

Test #3:

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

input:

3
0 50 -1
55 0 40
-1 40 0
1
0 2 180
3
0 1
1 2
1 0

output:

0 1 100.0000000000 100.0000000000
1 2 80.0000000000 80.0000000000
1 0 55.0000000000 110.0000000000

result:

ok 12 numbers

Test #4:

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

input:

6
0 960 -1 -1 -1 -1
-1 0 -1 -1 1000 -1
-1 1000 0 -1 -1 -1
-1 -1 -1 0 -1 -1
-1 -1 -1 1000 0 970
-1 -1 -1 -1 -1 0
3
0 3 5900
2 3 5800
2 5 5700
6
0 1
2 1
1 4
4 3
4 5
0 5

output:

0 1 1900.0000000000 1920.0000000000
2 1 1800.0000000000 1820.0000000000
1 4 1980.0000000000 2000.0000000000
4 3 1980.0000000000 2000.0000000000
4 5 1880.0000000000 1900.0000000000
0 5 5800.0000000000 5800.0000000000

result:

ok 24 numbers

Test #5:

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

input:

6
0 960 -1 -1 -1 -1
-1 0 -1 -1 1000 -1
-1 1000 0 -1 -1 -1
-1 -1 -1 0 -1 -1
-1 -1 -1 1000 0 940
-1 -1 -1 -1 -1 0
3
0 3 5900
2 3 5800
2 5 5700
6
0 1
2 1
1 4
4 3
4 5
0 5

output:

0 1 1920.0000000000 1920.0000000000
2 1 1820.0000000000 1820.0000000000
1 4 2000.0000000000 2000.0000000000
4 3 1980.0000000000 1980.0000000000
4 5 1880.0000000000 1880.0000000000
0 5 5800.0000000000 5800.0000000000

result:

ok 24 numbers

Test #6:

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

input:

6
0 950 -1 -1 -1 -1
-1 0 -1 -1 1000 -1
-1 1000 0 -1 -1 -1
-1 -1 -1 0 -1 -1
-1 -1 -1 1000 0 970
-1 -1 -1 -1 -1 0
3
0 3 5900
2 3 5800
2 5 5700
6
0 1
2 1
1 4
4 3
4 5
0 5

output:

0 1 1900.0000000000 1900.0000000000
2 1 1800.0000000000 1800.0000000000
1 4 2000.0000000000 2000.0000000000
4 3 2000.0000000000 2000.0000000000
4 5 1900.0000000000 1900.0000000000
0 5 5800.0000000000 5800.0000000000

result:

ok 24 numbers

Test #7:

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

input:

10
0 123 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 234 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 345 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 456 -1 -1 -1 -1 -1
-1 -1 -1 -1 0 567 -1 -1 -1 -1
-1 -1 -1 -1 -1 0 678 -1 -1 -1
-1 -1 -1 -1 -1 -1 0 890 -1 -1
-1 -1 -1 -1 -1 -1 -1 0 901 -1
-1 -1 -1 -1 -1 -1 -1 -1 0 555
666 -1 -1 -1 -1 -1 -1 -1 -1...

output:

0 0 0.0000000000 0.0000000000
0 1 216.0000000000 246.0000000000
0 2 450.0000000000 714.0000000000
0 3 1084.0000000000 1114.0000000000
0 4 1540.0000000000 1570.0000000000
0 5 2674.0000000000 2704.0000000000
0 6 3408.0000000000 3438.0000000000
0 7 4298.0000000000 4358.0000000000
0 8 5199.0000000000 55...

result:

ok 400 numbers

Test #8:

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

input:

10
0 123 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 234 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 345 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 456 -1 -1 -1 -1 -1
-1 -1 -1 -1 0 567 -1 -1 -1 -1
-1 -1 -1 -1 -1 0 678 -1 -1 -1
-1 -1 -1 -1 -1 -1 0 890 -1 -1
-1 -1 -1 -1 -1 -1 -1 0 901 -1
-1 -1 -1 -1 -1 -1 -1 -1 0 555
666 -1 -1 -1 -1 -1 -1 -1 -1...

output:

0 0 0.0000000000 0.0000000000
0 1 216.0000000000 246.0000000000
0 2 580.0000000000 640.0000000000
0 3 1084.0000000000 1114.0000000000
0 4 1540.0000000000 1570.0000000000
0 5 2674.0000000000 2704.0000000000
0 6 3408.0000000000 3438.0000000000
0 7 4298.0000000000 4358.0000000000
0 8 5199.0000000000 55...

result:

ok 400 numbers

Test #9:

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

input:

10
0 123 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 234 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 345 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 456 -1 -1 -1 -1 -1
-1 -1 -1 -1 0 567 -1 -1 -1 -1
-1 -1 -1 -1 -1 0 678 -1 -1 -1
-1 -1 -1 -1 -1 -1 0 890 -1 -1
-1 -1 -1 -1 -1 -1 -1 0 901 -1
-1 -1 -1 -1 -1 -1 -1 -1 0 555
666 -1 -1 -1 -1 -1 -1 -1 -1...

output:

0 0 0.0000000000 0.0000000000
0 1 245.0000000000 246.0000000000
0 2 609.0000000000 640.0000000000
0 3 1084.0000000000 1114.0000000000
0 4 1569.0000000000 1570.0000000000
0 5 2703.0000000000 2704.0000000000
0 6 3437.0000000000 3438.0000000000
0 7 4327.0000000000 4358.0000000000
0 8 5228.0000000000 55...

result:

ok 400 numbers

Test #10:

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

input:

3
0 10 -1
-1 0 10
10 -1 0
3
0 2 21
1 0 21
2 1 21
3
0 1
1 2
2 0

output:

0 1 10.5000000000 10.5000000000
1 2 10.5000000000 10.5000000000
2 0 10.5000000000 10.5000000000

result:

ok 12 numbers

Test #11:

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

input:

8
0 10 -1 -1 -1 -1 -1 -1
-1 0 10 -1 -1 -1 -1 -1
-1 -1 0 10 -1 -1 -1 -1
-1 -1 -1 0 10 -1 -1 -1
-1 -1 -1 -1 0 10 -1 -1
-1 -1 -1 -1 -1 0 10 -1
-1 -1 -1 -1 -1 -1 0 10
10 -1 -1 -1 -1 -1 -1 0
8
0 7 71
1 0 71
2 1 71
3 2 71
4 3 71
5 4 71
6 5 71
7 6 71
8
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 0

output:

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

result:

ok 32 numbers

Test #12:

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

input:

7
0 10 -1 -1 -1 -1 -1
-1 0 10 -1 -1 -1 -1
-1 -1 0 10 -1 -1 -1
-1 -1 -1 0 10 -1 -1
-1 -1 -1 -1 0 10 -1
-1 -1 -1 -1 -1 0 10
10 -1 -1 -1 -1 -1 0
6
0 4 41
1 5 41
2 6 41
3 0 41
5 2 41
6 3 41
7
0 1
1 2
2 3
3 4
4 5
5 6
6 0

output:

0 1 10.0000000000 11.0000000000
1 2 10.0000000000 10.3333333333
2 3 10.0000000000 10.3333333333
3 4 10.0000000000 10.3333333333
4 5 10.0000000000 11.0000000000
5 6 10.0000000000 10.3333333333
6 0 10.0000000000 10.3333333333

result:

ok 28 numbers

Test #13:

score: 0
Accepted
time: 7ms
memory: 3984kb

input:

30
0 392 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 793 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 750 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
703 -1 -1 0 -1 -1 -1 -1 -1 ...

output:

1 10 793.1724137931 793.1724137931
10 16 726.1724137931 726.1724137931
16 29 367.1724137931 367.1724137931
29 15 812.1724137931 812.1724137931
15 24 959.1724137931 959.1724137931
24 2 826.1724137931 826.1724137931
2 7 750.1724137931 750.1724137931
7 18 865.1724137931 865.1724137931
18 13 492.1724137...

result:

ok 400 numbers

Test #14:

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

input:

30
0 392 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 793 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 750 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
703 -1 -1 0 -1 -1 -1 -1 -1 ...

output:

1 10 793.0000000000 793.1785714286
10 16 726.0000000000 726.1785714286
16 29 367.0000000000 367.1785714286
29 15 812.0000000000 812.1785714286
15 24 959.0000000000 959.1785714286
24 2 826.0000000000 826.1785714286
2 7 750.0000000000 750.1785714286
7 18 865.0000000000 865.1785714286
18 13 492.0000000...

result:

ok 400 numbers

Test #15:

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

input:

1
0
100
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 ...

output:

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

result:

ok 400 numbers

Test #16:

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

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -1 -...

output:

0 0 0.0000000000 0.0000000000
1 1 0.0000000000 0.0000000000
2 2 0.0000000000 0.0000000000
3 3 0.0000000000 0.0000000000
4 4 0.0000000000 0.0000000000
5 5 0.0000000000 0.0000000000
6 6 0.0000000000 0.0000000000
7 7 0.0000000000 0.0000000000
8 8 0.0000000000 0.0000000000
9 9 0.0000000000 0.0000000000
...

result:

ok 400 numbers

Test #17:

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

input:

30
0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
1000 0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 1000 0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 1000 0 1000 -1...

output:

0 29 58000.0000000000 58000.0000000000
6 11 10000.0000000000 10000.0000000000
7 16 18000.0000000000 18000.0000000000
26 6 20000.0000000000 40000.0000000000
3 12 18000.0000000000 18000.0000000000
6 25 38000.0000000000 38000.0000000000
17 0 17000.0000000000 34000.0000000000
25 27 4000.0000000000 4000....

result:

ok 400 numbers

Test #18:

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

input:

30
0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
1000 0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 1000 0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 1000 0 1000 -1...

output:

0 29 29000.0000000000 29000.0000000000
6 11 5000.0000000000 5000.0000000000
7 16 9000.0000000000 9000.0000000000
26 6 20000.0000000000 40000.0000000000
3 12 9000.0000000000 9000.0000000000
6 25 19000.0000000000 19000.0000000000
17 0 17000.0000000000 34000.0000000000
25 27 2000.0000000000 2000.000000...

result:

ok 400 numbers

Test #19:

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

input:

30
0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
1000 0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 1000 0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 1000 0 1000 -1...

output:

0 29 29000.0000000000 29000.0000000000
6 11 5000.0000000000 5000.0000000000
7 16 9000.0000000000 9000.0000000000
26 6 40000.0000000000 40000.0000000000
3 12 9000.0000000000 9000.0000000000
6 25 19000.0000000000 19000.0000000000
17 0 34000.0000000000 34000.0000000000
25 27 2000.0000000000 2000.000000...

result:

ok 400 numbers

Test #20:

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

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 298 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 342 -1 -1 -1 -1 -1 -1 -1 -1 533 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 236 -1 -1 -1 -1 -1 -1 477 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1...

output:

8 29 1292.0000000000 1310.0000000000
14 4 1363.0000000000 2642.0000000000
14 7 1016.0000000000 1948.0000000000
21 28 236.0000000000 472.0000000000
0 20 2018.0000000000 3428.0000000000
2 1 5565.0000000000 5896.0000000000
9 26 5769.0000000000 6091.0000000000
4 20 1551.0000000000 3102.0000000000
10 6 4...

result:

ok 400 numbers

Test #21:

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

input:

30
0 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1
-1 -1 0 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 2 -...

output:

13 10 5.0000000000 5.0000000000
13 26 7.0000000000 8.0000000000
7 8 11.0000000000 16.0000000000
26 4 9.0000000000 12.0000000000
8 27 8.0000000000 10.0000000000
25 11 3.0000000000 5.0000000000
5 17 5.0000000000 5.0000000000
27 1 6.0000000000 7.0000000000
3 5 6.0000000000 6.0000000000
6 16 9.000000000...

result:

ok 400 numbers

Test #22:

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

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 1...

output:

7 29 28.0000000000 31.0000000000
0 16 56.0000000000 57.0000000000
21 8 16.5000000000 19.0000000000
5 11 31.0000000000 33.0000000000
17 1 58.0000000000 59.0000000000
19 16 55.0000000000 55.0000000000
8 28 46.0000000000 46.0000000000
10 14 8.0000000000 14.0000000000
16 24 67.0000000000 67.0000000000
2...

result:

ok 400 numbers

Test #23:

score: 0
Accepted
time: 42ms
memory: 4016kb

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 19 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 170 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 352 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 176 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -...

output:

3 14 491.0000000000 491.0000000000
15 10 936.0000000000 1226.0000000000
8 28 600.0000000000 600.0000000000
16 5 701.0000000000 701.0000000000
11 2 1583.0000000000 1880.0000000000
17 21 800.0000000000 800.0000000000
18 4 1421.0000000000 1847.0000000000
27 7 648.0000000000 745.0000000000
14 16 2942.00...

result:

ok 400 numbers

Test #24:

score: 0
Accepted
time: 61ms
memory: 4000kb

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 884 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 171 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 861 -1 -...

output:

2 27 4033.0000000000 4033.0000000000
17 16 6952.0000000000 7034.0000000000
2 20 1801.0000000000 1801.0000000000
5 19 2702.0000000000 2702.0000000000
20 23 5326.0000000000 5326.0000000000
11 0 5382.0000000000 5382.0000000000
9 22 5817.0000000000 5974.0000000000
8 9 7184.0000000000 7314.0000000000
26 ...

result:

ok 400 numbers

Test #25:

score: 0
Accepted
time: 115ms
memory: 4332kb

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 1...

output:

24 3 51.0000000000 51.0000000000
10 4 55.0000000000 55.0000000000
24 3 51.0000000000 51.0000000000
19 21 69.0000000000 69.0000000000
6 27 11.0000000000 11.0000000000
6 22 45.0000000000 45.0000000000
7 4 68.0000000000 68.0000000000
1 4 50.0000000000 50.0000000000
20 15 49.0000000000 49.0000000000
22 ...

result:

ok 400 numbers

Test #26:

score: 0
Accepted
time: 130ms
memory: 4176kb

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 130 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 523 -1 -1 72 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 513 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 2...

output:

5 4 3296.0000000000 3296.0000000000
6 17 528.0000000000 528.0000000000
4 15 3951.0000000000 3951.0000000000
1 10 1500.0000000000 1500.0000000000
15 25 3213.0000000000 3213.0000000000
1 16 83.0000000000 83.0000000000
19 14 5247.0000000000 5247.0000000000
28 22 3127.0000000000 3127.0000000000
25 26 14...

result:

ok 400 numbers

Test #27:

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

input:

30
0 10 -1 -1 -1 -1 825 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
986 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 889 -1 -1 -1 -1 -1 -1 -1 721 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 ...

output:

13 20 6819.0000000000 6819.0000000000
6 5 7003.0000000000 7003.0000000000
27 0 5367.0000000000 5367.0000000000
2 16 1307.0000000000 1307.0000000000
3 28 1965.0000000000 1965.0000000000
17 10 1442.0000000000 1442.0000000000
7 28 4092.0000000000 4092.0000000000
20 12 3446.0000000000 3446.0000000000
20...

result:

ok 400 numbers

Test #28:

score: 0
Accepted
time: 7ms
memory: 4120kb

input:

30
0 -1 -1 -1 -1 -1 -1 60 -1 -1 -1 -1 614 -1 31 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 146 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 778 -1 -1
118 96 0 -1 -1 232 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1...

output:

6 19 2253.0000000000 4506.0000000000
12 23 802.0000000000 1091.0000000000
17 28 2804.0000000000 3609.0000000000
22 7 595.0000000000 1190.0000000000
27 10 1225.0000000000 1658.0000000000
7 29 861.0000000000 1722.0000000000
5 0 875.0000000000 1687.0000000000
16 26 1676.0000000000 3126.0000000000
20 28...

result:

ok 400 numbers

Test #29:

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

input:

30
0 -1 -1 -1 -1 -1 347 -1 -1 -1 -1 -1 864 -1 -1 357 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 201 -1 -1 -1 -1 -1 -1 469 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 260 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 219 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 180 -1 837 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 108 ...

output:

28 18 999.0000000000 1974.0000000000
21 29 933.0000000000 1805.0000000000
21 20 434.0000000000 868.0000000000
22 28 1915.0000000000 3144.0000000000
11 23 877.0000000000 1754.0000000000
25 13 1033.0000000000 1110.0000000000
11 8 405.0000000000 810.0000000000
23 19 968.0000000000 1936.0000000000
24 26...

result:

ok 400 numbers

Test #30:

score: 0
Accepted
time: 21ms
memory: 4064kb

input:

30
0 -1 -1 -1 -1 254 -1 -1 -1 -1 -1 -1 -1 -1 -1 185 -1 -1 -1 168 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 258 98 -1 -1 -1 -1 -1 -1 437 -1 -1 -1 166 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 347 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 221 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 43...

output:

22 22 0.0000000000 0.0000000000
9 16 25.0000000000 47.0000000000
25 5 526.0000000000 1037.0000000000
8 24 494.0000000000 586.0000000000
10 23 935.0000000000 1405.0000000000
13 20 411.0000000000 411.0000000000
7 11 792.0000000000 1472.0000000000
6 26 781.0000000000 1233.0000000000
29 7 356.0000000000...

result:

ok 400 numbers

Test #31:

score: 0
Accepted
time: 39ms
memory: 4160kb

input:

30
0 -1 -1 -1 3 -1 2 -1 -1 -1 6 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 5 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 5 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 8 -1 -1 -1
1 2 -1 0 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -...

output:

8 15 19.0000000000 19.0000000000
7 18 17.0000000000 21.0000000000
10 15 15.0000000000 16.0000000000
10 7 11.0000000000 22.0000000000
25 13 18.0000000000 20.0000000000
29 15 3.0000000000 4.0000000000
11 5 8.0000000000 8.0000000000
28 12 24.0000000000 25.0000000000
5 19 22.0000000000 31.0000000000
0 2...

result:

ok 400 numbers

Test #32:

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

input:

30
0 592 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 76 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 605
-1 0 -1 -1 -1 412 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 201 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 531 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
873 -1 -1 0 -1 -1 -1 -1 -...

output:

6 26 684.0000000000 1368.0000000000
12 25 2584.0000000000 2584.0000000000
17 23 1273.0000000000 1307.0000000000
13 2 913.0000000000 947.0000000000
8 16 500.0000000000 572.0000000000
25 19 2299.0000000000 2299.0000000000
14 4 1418.0000000000 1418.0000000000
23 17 3155.0000000000 3155.0000000000
4 9 7...

result:

ok 400 numbers

Test #33:

score: 0
Accepted
time: 166ms
memory: 4396kb

input:

30
0 -1 196 -1 -1 -1 229 -1 -1 -1 -1 -1 -1 -1 -1 457 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 499 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 -1 534 -1 -1 808 -1 788 -1 324 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 475 -1 -1 -1 -1 -1 384 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 58 -1 0 -1 -1 -1 -...

output:

3 14 1088.0000000000 1088.0000000000
12 28 1072.0000000000 1272.0000000000
15 24 1976.0000000000 1976.0000000000
4 12 1025.0000000000 1301.0000000000
18 3 2082.0000000000 2082.0000000000
5 20 855.0000000000 1236.0000000000
2 6 994.0000000000 1409.0000000000
27 19 2924.0000000000 2924.0000000000
21 1...

result:

ok 400 numbers

Test #34:

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

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 1 1 -1 -1 1 -1 -1 -1 -1...

output:

15 4 4.0000000000 7.0000000000
18 19 3.0000000000 3.0000000000
26 26 0.0000000000 0.0000000000
18 17 5.0000000000 5.0000000000
2 19 6.0000000000 6.0000000000
10 2 4.0000000000 4.0000000000
16 21 3.0000000000 3.0000000000
23 28 1.0000000000 2.0000000000
24 14 4.0000000000 4.0000000000
4 25 5.00000000...

result:

ok 400 numbers

Test #35:

score: 0
Accepted
time: 112ms
memory: 4336kb

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 1 2 -1 -1 2 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 2 -1 -1 -1 -1 -1 -1 1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

output:

5 28 6.0000000000 7.0000000000
5 29 4.0000000000 7.0000000000
23 3 8.0000000000 11.0000000000
11 10 4.0000000000 4.0000000000
27 4 4.0000000000 4.0000000000
5 0 5.0000000000 5.0000000000
21 21 0.0000000000 0.0000000000
29 27 6.0000000000 6.0000000000
7 17 6.0000000000 6.0000000000
21 21 0.0000000000...

result:

ok 400 numbers

Test #36:

score: 0
Accepted
time: 91ms
memory: 4340kb

input:

30
0 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 3 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 3 -1 -1 -1 -1 -1 5 -1 -1 -1 3 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 5 -1 5 -1 -1 -1 -1...

output:

27 11 11.0000000000 11.0000000000
25 6 4.0000000000 4.0000000000
6 12 13.0000000000 13.0000000000
20 23 9.0000000000 9.0000000000
4 12 14.0000000000 14.0000000000
23 23 0.0000000000 0.0000000000
15 9 3.0000000000 3.0000000000
0 28 6.0000000000 6.0000000000
7 29 3.0000000000 3.0000000000
8 16 13.0000...

result:

ok 400 numbers

Test #37:

score: 0
Accepted
time: 129ms
memory: 4336kb

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 -1 -1 7 -1 -1 3 -1 -1 -1 -1 -1 8
-1 0 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 8 -1 -1 -1 -1 -1 2 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 9 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 -1 4 -1 -1 -1 2 3 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

output:

19 24 13.0000000000 15.0000000000
22 2 8.0000000000 8.0000000000
20 4 12.0000000000 12.0000000000
9 27 4.0000000000 4.0000000000
21 6 10.0000000000 11.0000000000
13 17 7.0000000000 7.0000000000
28 9 3.0000000000 3.0000000000
16 13 16.0000000000 16.0000000000
9 4 8.0000000000 8.0000000000
4 24 10.000...

result:

ok 400 numbers

Test #38:

score: 0
Accepted
time: 237ms
memory: 4628kb

input:

30
0 -1 -1 -1 9 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 14 -1 7 9 -1 -1 -1 11 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 12 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 12 -1 -1 -1 -1 13 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 19 -1 5 3 -1 -1 -1 -1 -1 -1 -1
-1 12 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 ...

output:

10 17 18.0000000000 18.0000000000
3 4 50.0000000000 50.0000000000
28 8 40.0000000000 47.0000000000
20 23 35.0000000000 50.0000000000
0 9 27.0000000000 47.0000000000
10 20 47.0000000000 74.0000000000
26 3 9.0000000000 9.0000000000
21 2 29.0000000000 29.0000000000
1 18 37.0000000000 37.0000000000
15 2...

result:

ok 400 numbers

Test #39:

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

input:

30
0 -1 -1 -1 23 58 -1 17 -1 -1 51 -1 21 65 -1 -1 -1 28 -1 45 -1 -1 -1 -1 -1 18 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 35 -1 8 -1 -1 48 -1 -1 -1 -1 -1 -1 -1
15 33 0 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 35 46 -1 -1 -1 -1 9 -1 -1 -1 -1 14 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 59 67 -1 5...

output:

9 20 115.0000000000 115.0000000000
24 10 111.0000000000 111.0000000000
23 12 118.0000000000 118.0000000000
21 7 202.0000000000 202.0000000000
21 19 94.0000000000 94.0000000000
17 11 83.0000000000 83.0000000000
14 4 148.0000000000 148.0000000000
2 8 95.0000000000 95.0000000000
14 2 91.0000000000 91.0...

result:

ok 400 numbers

Test #40:

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

input:

30
0 -1 435 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 484 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 472
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 105 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 929 -1 -1 -1 -1 -1
673 377 0 -1 -1 -1 -1 -1 -1 -1 -1 66 -1 -1 -1 -1 -1 -1 327 -1 70 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1...

output:

1 25 1915.0000000000 1915.0000000000
21 18 946.0000000000 1273.0000000000
2 13 1925.0000000000 1925.0000000000
2 20 136.0000000000 136.0000000000
20 6 1900.0000000000 1900.0000000000
3 27 904.0000000000 904.0000000000
17 9 1269.0000000000 1683.0000000000
24 23 1153.0000000000 1153.0000000000
12 28 1...

result:

ok 400 numbers

Test #41:

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

input:

30
0 -1 -1 -1 755 -1 -1 -1 -1 -1 732 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 285 -1 -1 -1 -1 -1 767 -1
-1 0 -1 -1 -1 -1 -1 566 -1 -1 -1 103 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 552 -1 -1
-1 149 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 883
-1 -1 -1 0 -1 -1 -1 -...

output:

16 18 3730.0000000000 3730.0000000000
11 7 146.0000000000 146.0000000000
23 6 3925.0000000000 3925.0000000000
6 15 1843.0000000000 1843.0000000000
26 18 1712.0000000000 1712.0000000000
0 10 1206.0000000000 1206.0000000000
29 7 2563.0000000000 2563.0000000000
26 24 2104.0000000000 2104.0000000000
7 1...

result:

ok 400 numbers

Test #42:

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

input:

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

output:

14 8 57.0000000000 57.0000000000
9 17 8.0000000000 9.0000000000
24 3 25.0000000000 26.0000000000
15 25 19.0000000000 19.0000000000
11 29 24.0000000000 26.0000000000
10 2 21.0000000000 22.0000000000
17 9 3.0000000000 4.0000000000
3 26 9.0000000000 10.0000000000
10 13 36.0000000000 37.0000000000
25 4 ...

result:

ok 400 numbers

Test #43:

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

input:

30
0 -1 -1 -1 3 -1 -1 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 1 -1 -1 6 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1...

output:

9 1 6.5000000000 7.5000000000
12 0 24.5000000000 25.5000000000
6 28 25.5000000000 31.0000000000
29 3 9.5000000000 10.0000000000
5 28 49.0000000000 54.5000000000
19 2 22.0000000000 23.0000000000
16 25 22.5000000000 22.5000000000
9 12 15.5000000000 16.0000000000
22 4 8.0000000000 9.0000000000
19 20 36...

result:

ok 400 numbers

Test #44:

score: 0
Accepted
time: 84ms
memory: 4368kb

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 7 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 7 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 3 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 8 -1 -...

output:

0 2 14.0000000000 14.0000000000
21 8 42.0000000000 43.0000000000
4 8 5.0000000000 6.0000000000
10 16 33.0000000000 34.0000000000
13 17 9.0000000000 11.0000000000
21 6 33.0000000000 33.0000000000
13 0 32.0000000000 34.0000000000
0 24 16.0000000000 17.0000000000
23 14 36.0000000000 38.0000000000
11 23...

result:

ok 400 numbers

Test #45:

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

input:

30
0 9 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
2 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 4 -1 -1 -1 -1 6
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1...

output:

17 13 41.5000000000 44.3333333333
5 3 19.0000000000 20.0000000000
9 13 22.0000000000 24.3333333333
15 18 22.3333333333 22.5000000000
0 5 33.3333333333 35.5000000000
9 26 23.3333333333 23.5000000000
6 29 39.0000000000 40.6666666667
4 8 20.5000000000 20.6666666667
5 16 34.0000000000 35.0000000000
19 1...

result:

ok 400 numbers

Test #46:

score: 0
Accepted
time: 133ms
memory: 4384kb

input:

30
0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 6 -1 -1 -1 -1 -1 2 5 -1 -1 -1 4 -1 -1 -1 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 6 -1 -1 -1 -1 -1 6 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 6 6 -1 -1 -1 4 -1 -...

output:

28 24 17.0000000000 22.5000000000
18 24 7.0000000000 7.0000000000
4 13 8.0000000000 8.5000000000
4 24 18.0000000000 31.0000000000
7 17 1.0000000000 2.0000000000
25 10 11.0000000000 18.0000000000
6 22 9.0000000000 9.0000000000
24 22 16.0000000000 16.5000000000
1 22 8.5000000000 9.0000000000
17 20 16....

result:

ok 400 numbers

Test #47:

score: 0
Accepted
time: 89ms
memory: 4628kb

input:

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

output:

2 6 4.0000000000 8.0000000000
10 19 9.0000000000 9.0000000000
4 15 18.0000000000 20.0000000000
24 2 8.0000000000 15.0000000000
7 20 14.0000000000 15.0000000000
2 19 7.0000000000 7.0000000000
9 10 12.0000000000 18.5000000000
25 27 12.0000000000 12.0000000000
20 6 15.0000000000 20.0000000000
25 28 15....

result:

ok 400 numbers

Test #48:

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

input:

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

output:

14 8 2.0000000000 3.0000000000
29 14 7.0000000000 10.0000000000
11 27 12.0000000000 12.0000000000
0 24 14.0000000000 18.0000000000
12 28 1.0000000000 2.0000000000
28 25 10.0000000000 11.0000000000
3 29 12.0000000000 13.0000000000
9 18 5.0000000000 7.0000000000
16 9 7.0000000000 7.0000000000
10 7 13....

result:

ok 400 numbers

Test #49:

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

input:

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

output:

25 7 17.0000000000 24.0000000000
7 6 6.0000000000 7.0000000000
12 16 7.0000000000 9.0000000000
22 24 11.0000000000 21.0000000000
3 9 19.0000000000 25.0000000000
15 21 4.0000000000 7.0000000000
17 29 17.0000000000 24.0000000000
20 22 6.0000000000 8.0000000000
22 21 10.0000000000 13.0000000000
17 22 1...

result:

ok 400 numbers

Test #50:

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

input:

30
0 -1 3 -1 -1 -1 -1 -1 5 -1 -1 -1 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 1 -1 -1 -1 -1...

output:

5 4 10.0000000000 14.6666666667
12 26 18.0000000000 26.0000000000
7 17 15.0000000000 15.0000000000
27 19 9.0000000000 12.6666666667
4 29 6.0000000000 10.0000000000
28 28 0.0000000000 0.0000000000
18 8 8.0000000000 8.6666666667
21 19 10.0000000000 15.0000000000
5 2 11.0000000000 17.0000000000
13 17 1...

result:

ok 400 numbers

Test #51:

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

input:

30
0 -1 -1 4 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 -1 -1 -1
-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 6 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 9 -1 -1
-1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 3 -1 -1 -1 -1 5 -1 -1 -1 -1 8 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 ...

output:

2 0 11.0000000000 20.0000000000
21 1 19.0000000000 23.0000000000
24 10 15.0000000000 16.0000000000
26 26 0.0000000000 0.0000000000
9 24 10.0000000000 17.0000000000
26 17 11.0000000000 16.0000000000
5 16 8.0000000000 9.0000000000
21 21 0.0000000000 0.0000000000
16 25 13.0000000000 16.0000000000
16 19...

result:

ok 400 numbers

Test #52:

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

input:

30
0 937 -1 -1 907 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 963 -1 -1 -1 -1 -1 -1
992 0 982 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 941 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 965 -1 -1 927 -1 -1 -1 -1 -1 -1 964 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 988 -1 -1 ...

output:

8 26 5147.0000000000 6893.0000000000
17 12 3141.0000000000 5670.0000000000
28 7 1941.0000000000 3529.0000000000
28 4 4529.0000000000 4948.0000000000
23 29 1860.0000000000 3720.0000000000
17 28 3299.0000000000 5050.5000000000
5 14 3416.0000000000 5269.0000000000
17 7 1877.0000000000 3754.0000000000
5...

result:

ok 400 numbers

Test #53:

score: 0
Accepted
time: 67ms
memory: 4364kb

input:

30
0 482 -1 -1 -1 -1 -1 -1 -1 -1 -1 422 936 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 0 266 -1 -1 -1 533 -1 -1 -1 -1 -1 39 -1 -1 -1 -1 -1 -1 -1 -1 110 -1 -1 -1 -1 -1 -1 -1 -1
-1 284 0 672 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 183 -1 -1 -1
-1 -1 -1 0 593 -1 -1 ...

output:

29 6 781.0000000000 1070.0000000000
24 10 1405.0000000000 1882.0000000000
24 15 1467.0000000000 2934.0000000000
11 16 2463.0000000000 2548.0000000000
4 15 1507.0000000000 1893.0000000000
14 4 1062.0000000000 1649.0000000000
19 25 1237.0000000000 1286.0000000000
12 4 823.0000000000 1387.0000000000
0 ...

result:

ok 400 numbers

Test #54:

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

input:

30
0 811 -1 -1 -1 984 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 655 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
839 0 519 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 976 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 0 783 -1 -1 -1 -1 -1 612 -1 -1 -1 -1 -1 -1 -1 562 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 545 -1 -1 ...

output:

3 6 1570.0000000000 3140.0000000000
22 25 2444.0000000000 4888.0000000000
22 10 4024.0000000000 7119.0000000000
8 22 1567.0000000000 3134.0000000000
3 17 1904.0000000000 3551.0000000000
18 9 2453.0000000000 4906.0000000000
24 11 1804.0000000000 3608.0000000000
17 7 3052.0000000000 3909.0000000000
29...

result:

ok 400 numbers