QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#129838#4370. Road TimesSwarthmore#AC ✓451ms4716kbC++176.4kb2023-07-23 01:52:422023-07-23 01:52:45

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-23 01:52:45]
  • 评测
  • 测评结果:AC
  • 用时:451ms
  • 内存:4716kb
  • [2023-07-23 01:52:42]
  • 提交

answer

#include "bits/stdc++.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef DEBUG
#define dbg(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << endl;
#else
#define dbg(x...)
#endif


const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; 

typedef double T;
typedef vector<vd> vvd;
const T eps = 1e-8, inf = 1/.0;
#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)) {
            F0R(i, m) F0R(j, n) D[i][j] = A[i][j];
            F0R(i, m) {
                B[i] = n+i, D[i][n] = -1, D[i][n+1] = b[i];
            }
            F0R(j, 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];
        F0R(i, m+2) if (i != r && abs(D[i][s]) > eps) {
            T *b = D[i].data(), binv = b[s]*inv;
            F0R(j, n+2) b[j] -= a[j]*binv;
            b[s] = a[s]*binv;
        }
        F0R(j, n+2) if (j != s) D[r][j] *= inv;
        F0R(i, 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;
        while(true) {
            int s = -1; F0R(j, n+1) if (N[j] != -phase) ltj(D[x]);
            if (D[x][s] >= -eps) return true;
            int r = -1;
            F0R(i, 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() {
        int r = 0; FOR(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;
            F0R(i, m) if (B[i] == -1) {
                int s = 0; FOR(j, 1, n+1) ltj(D[i]);
                pivot(i, s);
            }
        }
        bool ok = simplex(1); 
        return ok ? D[m][n+1] : inf;
    }
};

vector<vector<pair<int, pi>>> graph(31);
int N;

vi getPath(int r, int s) {
    int dist[N];
    F0R(i, N) dist[i] = 1e9;
    dist[r] = 0;
    pqg<pi> q; q.push({0, r});
    pi lst[N];
    while (!q.empty()) {
        auto [d, v] = q.top(); q.pop();
        if (d != dist[v]) continue;
        trav(a, graph[v]) {
            if (ckmin(dist[a.f], d + a.s.f)) {
                q.push({dist[a.f], a.f});
                lst[a.f] = {v, a.s.s};
            }
        }
    }
    int cur = s;
    vi res;
    while (cur != r) {
        res.pb(lst[cur].s); cur = lst[cur].f;
    }
    return res;
}

void solve() {
    cin >> N;
    int nr = 0;
    vd dist;
    F0R(i, N) {
        F0R(j, N) {
            int X; cin >> X;
            if (i != j && X != -1) {
                graph[i].pb({j, {X, nr}});
                dist.pb(X);
                nr++;
            }
        }
    }

    vvd A;
    vd B;
    F0R(i, nr) {
        vd cur(nr);
        cur[i] = 1;
        A.pb(cur);
        B.pb(dist[i]*2);
        cur[i] = -1;
        A.pb(cur);
        B.pb(-dist[i]);
    }
    int R; cin >> R;
    F0R(i, R) {
        int X, Y; ld T; cin >> X >> Y >> T;
        vi pth = getPath(X, Y);
        vd cur(nr);
        trav(a, pth) cur[a] = 1;
        A.pb(cur);
        B.pb(T+2*eps);
        trav(a, pth) cur[a] = -1;
        A.pb(cur);
        B.pb(-T+2*eps);
    }



    cout << setprecision(20);
    int Q; cin >> Q;
    while(Q--) {
        int X, Y; cin >> X >> Y;
        cout << X << " " << Y << " ";
        vi pth = getPath(X, Y);
        vd cur(nr);
        trav(a, pth) cur[a] = -1;
        LPSolver lp1(A, B, cur);
        cout << -lp1.solve() << " ";
        trav(a, pth) cur[a] = 1;
        LPSolver lp2(A, B, cur);
        cout << lp2.solve() << nl;
    }

}
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int T = 1;
//    cin >> T;
    while(T--) {
        solve();
    }

	return 0;
}



Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 80.000000020000001655
1 2 40 70.000000020000001655
1 0 55 110

result:

ok 12 numbers

Test #2:

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

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 50.000000020000001655
1 2 40 40.000000020000001655
1 0 55 110

result:

ok 12 numbers

Test #3:

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

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 99.999999980000040978 99.999999999999971578
1 2 79.999999980000040978 79.999999999999971578
1 0 55 109.99999999999997158

result:

ok 12 numbers

Test #4:

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

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 1899.9999999800002115 1920
2 1 1799.9999999800002115 1820.000000039999577
1 4 1979.9999999800002115 2000
4 3 1979.9999999800002115 2000
4 5 1879.9999999400006345 1900.000000039999577
0 5 5799.9999999400006345 5800.0000000599993655

result:

ok 24 numbers

Test #5:

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

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 1919.9999999400006345 1920
2 1 1819.9999999800002115 1820.000000039999577
1 4 1999.9999999400006345 2000
4 3 1979.9999999800002115 1980.000000039999577
4 5 1879.9999999400006345 1880
0 5 5799.9999999400006345 5800

result:

ok 24 numbers

Test #6:

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

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 1899.9999999800002115 1900
2 1 1799.9999999800002115 1800.000000039999577
1 4 1999.9999999800002115 2000
4 3 1999.9999999800002115 2000
4 5 1899.9999999400006345 1900.000000039999577
0 5 5799.9999999400006345 5800.000000039999577

result:

ok 24 numbers

Test #7:

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

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 0
0 1 215.9999999000000912 246
0 2 449.99999990000026173 714.00000000000022737
0 3 1083.9999999400001798 1114.0000000400002591
0 4 1539.9999999400001798 1570.0000000400002591
0 5 2673.999999939999725 2704.0000000399991222
0 6 3407.9999999200003913 3438.0000000200002432
0 7 4297.99999992000084...

result:

ok 400 numbers

Test #8:

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

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 0
0 1 215.99999990000105754 246
0 2 579.99999990000060279 640.00000013999840576
0 3 1083.9999999400006345 1114.000000039999577
0 4 1539.9999999400006345 1570.000000039999577
0 5 2673.9999999400006345 2704.000000039999577
0 6 3407.999999920000846 3438.0000000199997885
0 7 4297.999999920000846 ...

result:

ok 400 numbers

Test #9:

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

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 0
0 1 244.99999992000113025 246.00000000000005684
0 2 608.99999992000118709 640.0000001399980647
0 3 1083.9999999400006345 1114.0000000399993496
0 4 1568.9999999600001956 1570.0000000399991222
0 5 2702.999999960000423 2704.0000000399991222
0 6 3436.9999999400010893 3438.0000000200002432
0 7 4...

result:

ok 400 numbers

Test #10:

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

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.499999969999997518 10.500000030000002482
1 2 10.499999969999997518 10.500000030000002482
2 0 10.499999969999997518 10.500000030000002482

result:

ok 12 numbers

Test #11:

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

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.142857105714288224 10.142857180000007133
1 2 10.142857105714288224 10.142857180000007133
2 3 10.142857105714282895 10.142857180000005357
3 4 10.142857105714282895 10.142857180000005357
4 5 10.142857105714282895 10.142857180000005357
5 6 10.142857105714282895 10.142857180000005357
6 7 10.14285...

result:

ok 32 numbers

Test #12:

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

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 11.00000002000000876
1 2 9.9999999999999964473 10.333333380000002677
2 3 9.9999999999999964473 10.333333380000002677
3 4 9.9999999999999964473 10.333333380000002677
4 5 10 11.00000002000000876
5 6 9.9999999999999964473 10.333333380000002677
6 0 9.9999999999999964473 10.333333380000002677

result:

ok 28 numbers

Test #13:

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

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.17241375378887369 793.17241383241423591
10 16 726.17241375379160218 726.1724138324143496
16 29 367.17241375379251167 367.1724138324143496
29 15 812.17241375379160218 812.1724138324143496
15 24 959.17241375379160218 959.17241383241480435
24 2 826.17241375379160218 826.17241383241480435
2 7 7...

result:

ok 400 numbers

Test #14:

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

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.00000000000079581 793.17857146785786426
10 16 726.00000000000045475 726.17857146785797795
16 29 367.00000000000051159 367.17857146785809164
29 15 812.00000000000045475 812.17857146785797795
15 24 959.00000000000045475 959.1785714678584327
24 2 826.00000000000045475 826.1785714678584327
2 7 ...

result:

ok 400 numbers

Test #15:

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

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

result:

ok 400 numbers

Test #16:

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

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 0
1 1 -0 0
2 2 -0 0
3 3 -0 0
4 4 -0 0
5 5 -0 0
6 6 -0 0
7 7 -0 0
8 8 -0 0
9 9 -0 0
10 10 -0 0
11 11 -0 0
12 12 -0 0
13 13 -0 0
14 14 -0 0
15 15 -0 0
16 16 -0 0
17 17 -0 0
18 18 -0 0
19 19 -0 0
20 20 -0 0
21 21 -0 0
22 22 -0 0
23 23 -0 0
24 24 -0 0
25 25 -0 0
26 26 -0 0
27 27 -0 0
28 28 -0 0
2...

result:

ok 400 numbers

Test #17:

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

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 57999.999999979998393 57999.999999999956344
6 11 9999.9999999800511432 10000.000000000005457
7 16 17999.999999980042048 17999.999999999996362
26 6 20000.000000000010914 40000.000000000007276
3 12 17999.999999980042048 17999.999999999996362
6 25 37999.99999998002022 37999.999999999978172
17 0 16...

result:

ok 400 numbers

Test #18:

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

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.000000000025466 29000.000000020001607
6 11 5000.000000000003638 5000.0000000199806891
7 16 9000.000000000007276 9000.0000000199834176
26 6 20000.000000000014552 40000.000000000014552
3 12 9000.0000000000109139 9000.0000000199870556
6 25 19000.000000000021828 19000.00000001999797
17 0 1700...

result:

ok 400 numbers

Test #19:

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

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 28999.999999999996362 29000.000000019990694
6 11 5000.000000000001819 5000.0000000199961505
7 16 9000.000000000001819 9000.0000000199961505
26 6 39999.999999979998393 39999.999999999992724
3 12 8999.999999999998181 9000.0000000199925125
6 25 19000 19000.000000019994332
17 0 33999.99999998002749...

result:

ok 400 numbers

Test #20:

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

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 1291.9999999600008778 1310.0000000400000317
14 4 1362.999999960000423 2642
14 7 1015.999999960000423 1947.9999999999995453
21 28 236.00000000000002842 471.99999999999982947
0 20 2017.9999999799997568 3428.0000000199984242
2 1 5564.999999960000423 5896.000000079999154
9 26 5768.999999960000423 6...

result:

ok 400 numbers

Test #21:

score: 0
Accepted
time: 54ms
memory: 4060kb

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 5.0000000600000005235
13 26 7 8.0000000399999979805
7 8 10.999999980000003674 16.000000079999992408
26 4 8.9999999600000002431 12.000000079999997737
8 27 7.999999980000007227 10.000000019999999878
25 11 3 5.0000000199999954376
5 17 5.0000000000000035527 5.0000000400000059742
27 1 5.999999999...

result:

ok 400 numbers

Test #22:

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

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 27.999999699999982283 31.000000019999983891
0 16 55.99999995999999669 57.000000140000011584
21 8 16.499999819999988659 19.000000019999994549
5 11 30.999999919999996933 33.000000160000013238
17 1 57.999999940000002141 59.000000260000028618
19 16 54.999999960000003796 55.000000160000020344
8 28 4...

result:

ok 400 numbers

Test #23:

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

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 490.99999974000218117 491.00000025999781883
15 10 935.99999978000175815 1226.0000002199981282
8 28 599.99999990000128491 600.00000009999939721
16 5 700.99999994000029346 701.00000005999970654
11 2 1582.9999997400032044 1880.0000002599981599
17 21 799.99999982000156251 800.0000001799983238
18 4 ...

result:

ok 400 numbers

Test #24:

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

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 4032.9999998999974196 4033.0000000999975782
17 16 6951.9999998800039975 7034.0000000799964255
2 20 1800.9999999199992544 1801.0000000799984718
5 19 2701.9999998000062078 2702.0000001999951564
20 23 5325.9999998999937816 5326.000000099994395
11 0 5381.9999999200017555 5382.0000000800055204
9 22 ...

result:

ok 400 numbers

Test #25:

score: 0
Accepted
time: 142ms
memory: 4352kb

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 50.999999939999945298 51.000000059999926805
10 4 54.999999980000033872 55.00000002000000876
24 3 50.999999939999945298 51.000000059999926805
19 21 68.999999939999966614 69.000000059999962332
6 27 10.99999998000001078 11.000000020000005208
6 22 44.999999959999954058 45.000000079999971092
7 4 67....

result:

ok 400 numbers

Test #26:

score: 0
Accepted
time: 126ms
memory: 4272kb

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 3295.9999999599999683 3296.0000000399991222
6 17 527.99999988000138273 528.00000011999804883
4 15 3950.999999900001967 3951.0000000999993972
1 10 1499.9999999000006028 1500.0000000999982603
15 25 3212.9999999200013008 3213.0000000799996087
1 16 82.999999900000986486 83.000000099998928249
19 14 5...

result:

ok 400 numbers

Test #27:

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

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 6818.999999939999725 6819.0000000799982445
6 5 7002.9999999200017555 7003.000000060000275
27 0 5366.9999999400006345 5367.000000059996637
2 16 1306.9999999200003913 1307.0000000799996087
3 28 1964.9999999399992703 1965.0000000599993655
17 10 1441.9999999799990746 1442.0000000199997885
7 28 409...

result:

ok 400 numbers

Test #28:

score: 0
Accepted
time: 131ms
memory: 4272kb

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 4506
12 23 802 1091.0000000200002432
17 28 2803.9999999800006663 3609.0000000200011527
22 7 595 1190.0000000000004547
27 10 1225 1658.0000000400000317
7 29 861 1722.0000000000004547
5 0 875 1687.0000000200000159
16 26 1676 3126.0000000200002432
20 28 591 1182.0000000000004547
0 21 840 1680...

result:

ok 400 numbers

Test #29:

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

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 1974.0000000199997885
21 29 932.99999997999975676 1805.0000000199997885
21 20 434 868
22 28 1914.999999960000423 3144.0000000199997885
11 23 877 1754
25 13 1032.9999999799999841 1110.0000000199997885
11 8 405 810
23 19 968 1936
24 26 100 193.00000001999978849
1 6 989.99999997999975676 1706...

result:

ok 400 numbers

Test #30:

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

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 0
9 16 24.999999999999996447 47.000000020000015866
25 5 526 1037.0000000200000159
8 24 493.99999997999998413 586.00000002000001587
10 23 934.99999989999992067 1405.000000060000275
13 20 410.99999997999998413 411.00000002000001587
7 11 792 1472.0000001200000952
6 26 780.99999989999992067 123...

result:

ok 400 numbers

Test #31:

score: 0
Accepted
time: 163ms
memory: 4472kb

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 18.999999939999998588 19.000000040000006862
7 18 16.999999899999995279 21.000000040000006862
10 15 14.999999979999998345 16.000000080000006619
10 7 11 22
25 13 18 20.000000020000001655
29 15 2.9999999999999995559 4.0000000600000040762
11 5 7.9999999799999983452 8.000000100000008274
28 12 23.999...

result:

ok 400 numbers

Test #32:

score: 0
Accepted
time: 182ms
memory: 4460kb

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 1368
12 25 2583.9999999800002115 2584.0000000199997885
17 23 1272.9999999000010575 1307.0000000999989425
13 2 912.99999996000042302 947.00000003999957698
8 16 499.99999992000084603 572.00000007999915397
25 19 2298.9999997000031726 2299.0000002999968274
14 4 1417.999999960000423 1418.0000000...

result:

ok 400 numbers

Test #33:

score: 0
Accepted
time: 298ms
memory: 4520kb

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 1087.9999999200003913 1088.0000000799998361
12 28 1071.9999998800003596 1272.0000001199998678
15 24 1975.999999979999302 1976.0000000199997885
4 12 1024.9999998400010099 1301.0000001699993391
18 3 2081.9999999400001798 2082.0000000599989107
5 20 854.99999998000021151 1236.0000000000002274
2 6 9...

result:

ok 400 numbers

Test #34:

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

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 7.0000000199999989903
18 19 2.9999999600000015754 3.0000000199999998785
26 26 -0 0
18 17 4.9999999799999992334 5.0000000199999989903
2 19 5.9999999400000039174 6.0000000399999997569
10 2 3.9999999600000015754 4
16 21 2.9999999600000011313 3.0000000200000007666
23 28 1 2
24 14 4 4.000000019999...

result:

ok 400 numbers

Test #35:

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

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 5.9999999799999992334 7.0000000199999989903
5 29 4 7.0000000199999998785
23 3 7.9999999799999992334 11.000000039999999757
11 10 3.9999999400000003646 4.0000000399999997569
27 4 3.9999999400000003646 4.0000001199999992707
5 0 4.9999999799999992334 5.0000000199999989903
21 21 -0 0
29 27 5.9999999...

result:

ok 400 numbers

Test #36:

score: 0
Accepted
time: 273ms
memory: 4648kb

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 10.999999880000004282 11.000000059999999635
25 6 3.9999999799999987893 4.0000000199999981021
6 12 12.999999960000000243 13.000000040000005086
20 23 8.9999999600000002431 9.0000000199999998785
4 12 13.999999920000002263 14.000000059999999635
23 23 -0 0
15 9 2.9999999600000002431 3.0000000399999...

result:

ok 400 numbers

Test #37:

score: 0
Accepted
time: 338ms
memory: 4540kb

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.000000000000007105 15.000000080000004843
22 2 7.9999999799999983452 8.0000000400000015333
20 4 11.999999939999991483 12.000000079999995961
9 27 3.9999999799999996775 4.0000000199999963257
21 6 9.9999999800000018979 11.000000020000003431
13 17 6.9999999200000004862 7.0000000600000040762
28 9...

result:

ok 400 numbers

Test #38:

score: 0
Accepted
time: 330ms
memory: 4708kb

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 17.999999999999992895 18.000000160000013238
3 4 49.999999980000019661 50.000000020000022971
28 8 39.999999980000005451 47.00000008000002083
20 23 34.999999940000009246 50.00000006000001207
0 9 27.000000000000003553 47.000000020000015866
10 20 46.999999979999984134 74.000000020000001655
26 3 8....

result:

ok 400 numbers

Test #39:

score: 0
Accepted
time: 451ms
memory: 4716kb

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 114.99999988000007534 115.0000001266664782
24 10 110.99999966000031293 111.00000035999944714
23 12 117.99999991333331195 118.00000005999989128
21 7 201.9999999400002082 202.00000005999996233
21 19 93.999999900000034359 94.000000059999891278
17 11 82.999999933333342028 83.000000089999744546
14 4...

result:

ok 400 numbers

Test #40:

score: 0
Accepted
time: 356ms
memory: 4596kb

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 1914.9999998799999048 1915.0000001199971393
21 18 945.99999991999982285 1273.0000000800005182
2 13 1924.9999999400017714 1925.0000000600005023
2 20 135.99999991999993654 136.00000003999994647
20 6 1899.9999999000015123 1900.0000001000000793
3 27 903.99999997999975676 904.00000001999978849
17 9 ...

result:

ok 400 numbers

Test #41:

score: 0
Accepted
time: 411ms
memory: 4716kb

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 3729.999999900005605 3730.000000099994395
11 7 145.99999995000382569 146.00000005999550012
23 6 3924.9999999000069693 3925.0000000999971235
6 15 1842.9999999200038019 1843.0000000799986992
26 18 1711.9999999400060915 1712.0000000599957275
0 10 1205.9999997800100573 1206.0000002499893981
29 7 2...

result:

ok 400 numbers

Test #42:

score: 0
Accepted
time: 143ms
memory: 4292kb

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 56.99999997999999124 57.000000019999987444
9 17 7.9999999600000020195 9.0000000399999997569
24 3 24.999999919999996933 26.000000099999986958
15 25 18.99999997999999124 19.000000019999994549
11 29 23.999999879999990071 26.000000200000002337
10 2 20.999999980000016109 22.000000059999997859
17 9 2...

result:

ok 400 numbers

Test #43:

score: 0
Accepted
time: 139ms
memory: 4296kb

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.499999589999958971 7.5000001400000213536
12 0 24.499999920000014697 25.500000250000020685
6 28 25.499999920000007592 31.00000004000000331
29 3 9.4999998699999821383 9.9999999999999964473
5 28 48.999999860000016838 54.500000110000016207
19 2 21.999999759999994353 23.000000180000011341
16 25 22....

result:

ok 400 numbers

Test #44:

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

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 13.999999980000003674 14.000000020000017642
21 8 41.99999998000008361 43.000000020000072709
4 8 5.0000000000000142109 6.0000000999999967277
10 16 32.999999980000033872 34.00000002000000876
13 17 8.9999999799999983452 11.00000002000000876
21 6 32.99999975999993751 33.000000220000032414
13 0 31.99...

result:

ok 400 numbers

Test #45:

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

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.499999839999979656 44.333333479999993187
5 3 18.999999980000001898 20.000000040000013968
9 13 21.999999980000023214 24.333333453333363394
15 18 22.33333322666666021 22.500000090000000341
0 5 33.333333153333320809 35.500000150000012411
9 26 23.333333153333320809 23.500000180000011341
6 29 38...

result:

ok 400 numbers

Test #46:

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

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 16.999999960000000243 22.500000110000009101
18 24 6.9999999599999975786 7.000000040000005086
4 13 7.9999999799999965688 8.500000090000009223
4 24 17.999999959999993138 31.000000019999994549
7 17 1.0000000000000006661 1.9999999999999986677
25 10 10.99999995999999669 18
6 22 8.999999939999995035...

result:

ok 400 numbers

Test #47:

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

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 7.9999999999999982236
10 19 8.9999999800000001215 9.0000000199999998785
4 15 17.999999959999993138 20.000000019999990997
24 2 7.9999999999999982236 15.000000019999998102
7 20 13.999999980000000122 15.000000040000001533
2 19 6.9999999799999983452 7.0000000199999998785
9 10 12 18.500000049999993...

result:

ok 400 numbers

Test #48:

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

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.0000000000000013323 3.0000000200000038753
29 14 6.9999999800000018979 9.9999999999999982236
11 27 11.999999979999998345 12.000000019999999878
0 24 13.999999979999998345 18.000000020000001655
12 28 0.99999999999999977796 1.9999999999999982236
28 25 9.9999999800000018979 11.000000100000011827
3...

result:

ok 400 numbers

Test #49:

score: 0
Accepted
time: 224ms
memory: 4712kb

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 16.999999980000009003 24.000000040000006862
7 6 6 7.0000000200000007666
12 16 6.9999999799999983452 9.0000000200000016548
22 24 10.999999999999998224 21.000000020000001655
3 9 18.999999939999998588 25.000000099999997616
15 21 3.9999999999999995559 7.0000000199999989903
17 29 16.9999999400000056...

result:

ok 400 numbers

Test #50:

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

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 9.9999999999999982236 14.666666853333321541
12 26 17.999999960000000243 26.000000020000001655
7 17 14.999999980000005451 15.000000020000005208
27 19 9 12.666666779999991022
4 29 6 10.000000059999996083
28 28 -0 0
18 8 7.9999999800000018979 8.6666667466666602593
21 19 9.9999999599999984667 15.000...

result:

ok 400 numbers

Test #51:

score: 0
Accepted
time: 266ms
memory: 4716kb

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 10.999999999999998224 20.000000020000001655
21 1 18.999999839999986762 23.000000240000002094
24 10 14.999999939999998588 16.000000020000012313
26 26 -0 0
9 24 9.9999999999999982236 17.000000060000004964
26 17 10.999999980000001898 16.000000020000001655
5 16 7.9999999799999947925 9.00000006000000...

result:

ok 400 numbers

Test #52:

score: 0
Accepted
time: 186ms
memory: 4448kb

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 5146.9999999000028765 6893.000000019998879
17 12 3140.9999998600037543 5669.999999999998181
28 7 1941.0000000000015916 3529.0000000199993337
28 4 4528.9999999200017555 4948.000000060000275
23 29 1860.0000000000009095 3719.9999999999995453
17 28 3298.999999959996785 5050.5000001699909262
5 14 34...

result:

ok 400 numbers

Test #53:

score: 0
Accepted
time: 190ms
memory: 4404kb

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 780.99999995999985458 1070.0000000399993496
24 10 1404.9999999400004072 1882.0000000199993337
24 15 1467.0000000000002274 2934
11 16 2462.999999939999725 2548.0000000599989107
4 15 1506.9999998800010417 1893.0000000399993496
14 4 1061.999999960000423 1649.0000000399998044
19 25 1236.99999996000...

result:

ok 400 numbers

Test #54:

score: 0
Accepted
time: 172ms
memory: 4504kb

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 3140
22 25 2444.0000000000004547 4888.000000000003638
22 10 4023.999999960000423 7119.000000040001396
8 22 1567 3134.0000000000009095
3 17 1903.9999999999988631 3551.0000000199997885
18 9 2453.0000000000004547 4906.000000000001819
24 11 1804.0000000000002274 3608.0000000000013642
17 7 3051....

result:

ok 400 numbers