QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#203690#4370. Road TimesPetroTarnavskyiAC ✓724ms4604kbC++174.7kb2023-10-06 19:25:382023-10-06 19:25:38

Judging History

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

  • [2023-10-06 19:25:38]
  • 评测
  • 测评结果:AC
  • 用时:724ms
  • 内存:4604kb
  • [2023-10-06 19:25:38]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

const db EPS = 1e-9;
const db LINF = 1.1e18;

const int INF = 1.01e9;

struct Simplex
{
	void pivot(int l, int e)
	{
		assert(0 <= l && l < m);
		assert(0 <= e && e < n);
		assert(abs(a[l][e]) > EPS);
		b[l] /= a[l][e];
		FOR(j, 0, n)
			if (j != e)
				a[l][j] /= a[l][e];
		a[l][e] = 1 / a[l][e];
		FOR(i, 0, m)
		{
			if (i != l)
			{
				b[i] -= a[i][e] * b[l];
				FOR(j, 0, n)
					if (j != e)
						a[i][j] -= a[i][e] * a[l][j];
				a[i][e] *= -a[l][e];
			}
		}
		v += c[e] * b[l];
		FOR(j, 0, n)
			if (j != e)
				c[j] -= c[e] * a[l][j];
		c[e] *= -a[l][e];
		swap(nonBasic[e], basic[l]);
	}
	void findOptimal()
	{
		vector<db> delta(m);
		while (true)
		{
			int e = -1;
			FOR(j, 0, n)
				if (c[j] > EPS && (e == -1 || nonBasic[j] < nonBasic[e]))
					e = j;
			if (e == -1)
				break;
			FOR(i, 0, m)
				delta[i] = a[i][e] > EPS ? b[i] / a[i][e] : LINF;
			int l = min_element(ALL(delta)) - delta.begin();
			if (delta[l] == LINF)
			{
				// unbounded
				assert(false);
			}
			pivot(l, e);
		}
	}
	void initializeSimplex(const vector<vector<db>>& _a, const vector<db>& _b, const vector<db>& _c)
	{
		m = SZ(_b);
		n = SZ(_c);
		nonBasic.resize(n);
		iota(ALL(nonBasic), 0);
		basic.resize(m);
		iota(ALL(basic), n);
		a = _a;
		b = _b;
		c = _c;
		v = 0;
		int k = min_element(ALL(b)) - b.begin();
		if (b[k] > -EPS)
			return;
		nonBasic.PB(n);
		iota(ALL(basic), n + 1);
		FOR(i, 0, m)
			a[i].PB(-1);
		c.assign(n, 0);
		c.PB(-1);
		n++;
		pivot(k, n - 1);
		findOptimal();
		if (v < -EPS)
		{
			// infeasible
			assert(false);
		}
		int l = find(ALL(basic), n - 1) - basic.begin();
		if (l != m)
		{
			int e = -1;
			while (abs(a[l][e]) < EPS)
				e++;
			pivot(l, e);
		}
		n--;
		int p = find(ALL(nonBasic), n) - nonBasic.begin();
		assert(p < n + 1);
		nonBasic.erase(nonBasic.begin() + p);
		FOR(i, 0, m)
			a[i].erase(a[i].begin() + p);
		c.assign(n, 0);
		FOR(j, 0, n)
		{
			if (nonBasic[j] < n)
				c[j] = _c[nonBasic[j]];
			else
				nonBasic[j]--;
		}
		FOR(i, 0, m)
		{
			if (basic[i] < n)
			{
				v += _c[basic[i]] * b[i];
				FOR(j, 0, n)
					c[j] -= _c[basic[i]] * a[i][j];
			}
			else
				basic[i]--;
		}
	}
	pair<vector<db>, db> simplex(const vector<vector<db>>& _a, const vector<db>& _b, const vector<db>& _c)
	{
		initializeSimplex(_a, _b, _c);
		assert(SZ(a) == m);
		FOR(i, 0, m)
			assert(SZ(a[i]) == n);
		assert(SZ(b) == m);
		assert(SZ(c) == n);
		assert(SZ(nonBasic) == n);
		assert(SZ(basic) == m);
		findOptimal();
		vector<db> x(n);
		FOR(i, 0, m)
			if (basic[i] < n)
				x[basic[i]] = b[i];
		return {x, v};
	}
private:
	int m, n;
	VI nonBasic, basic;
	vector<vector<db>> a;
	vector<db> b;
	vector<db> c;
	db v;
} simplex;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	vector<VI> g(n, VI(n)), dist(n, VI(n)), lastEdge(n, VI(n));
	vector<pair<int, int>> edges;
	FOR(i, 0, n)
	{
		FOR(j, 0, n)
		{
			cin >> g[i][j];
			if (i == j)
				assert(g[i][j] == 0);
			else if (g[i][j] == -1)
				dist[i][j] = INF;
			else
			{
				dist[i][j] = g[i][j];
				lastEdge[i][j] = SZ(edges);
				edges.emplace_back(i, j);
			}
		}
	}
	FOR(k, 0, n)
		FOR(i, 0, n)
			FOR(j, 0, n)
			{
				if (dist[i][k] + dist[k][j] < dist[i][j])
				{
					dist[i][j] = dist[i][k] + dist[k][j];
					lastEdge[i][j] = lastEdge[k][j];
				}
			}
	int m = SZ(edges);
	vector<vector<db>> a;
	vector<db> b;
	FOR(i, 0, m)
	{
		auto [u, v] = edges[i];
		vector<db> ai(m);
		ai[i] = -1;
		a.PB(ai);
		b.PB(-g[u][v]);
		ai[i] = 1;
		a.PB(ai);
		b.PB(2 * g[u][v]);
	}
	int r;
	cin >> r;
	while (r--)
	{
		int s, d, t;
		cin >> s >> d >> t;
		vector<db> ai(m);
		while (s != d)
		{
			int e = lastEdge[s][d];
			ai[e] = 1;
			d = edges[e].F;
		}
		a.PB(ai);
		b.PB(t);
		FOR(i, 0, m)
			ai[i] *= -1;
		a.PB(ai);
		b.PB(-t);
	}
	int q;
	cin >> q;
	while (q--)
	{
		int s, d;
		cin >> s >> d;
		vector<db> c(m);
		cout << s << " " << d;
		while (s != d)
		{
			int e = lastEdge[s][d];
			c[e] = -1;
			d = edges[e].F;
		}
		cout << " " << -simplex.simplex(a, b, c).S;
		FOR(i, 0, m)
			c[i] *= -1;
		cout << " " << simplex.simplex(a, b, c).S << "\n";
	}
	return 0;
}

詳細信息

Test #1:

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

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.000000000000000 80.000000000000000
1 2 40.000000000000000 70.000000000000000
1 0 55.000000000000000 110.000000000000000

result:

ok 12 numbers

Test #2:

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

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.000000000000000 50.000000000000000
1 2 40.000000000000000 40.000000000000000
1 0 55.000000000000000 110.000000000000000

result:

ok 12 numbers

Test #3:

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

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.000000000000000 100.000000000000000
1 2 80.000000000000000 80.000000000000000
1 0 55.000000000000000 110.000000000000000

result:

ok 12 numbers

Test #4:

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

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.000000000000000 1920.000000000000000
2 1 1800.000000000000000 1820.000000000000000
1 4 1980.000000000000000 2000.000000000000000
4 3 1980.000000000000000 2000.000000000000000
4 5 1880.000000000000000 1900.000000000000000
0 5 5800.000000000000000 5800.000000000000000

result:

ok 24 numbers

Test #5:

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

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.000000000000000 1920.000000000000000
2 1 1820.000000000000000 1820.000000000000000
1 4 2000.000000000000000 2000.000000000000000
4 3 1980.000000000000000 1980.000000000000000
4 5 1880.000000000000000 1880.000000000000000
0 5 5800.000000000000000 5800.000000000000000

result:

ok 24 numbers

Test #6:

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

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.000000000000000 1900.000000000000000
2 1 1800.000000000000000 1800.000000000000000
1 4 2000.000000000000000 2000.000000000000000
4 3 2000.000000000000000 2000.000000000000000
4 5 1900.000000000000000 1900.000000000000000
0 5 5800.000000000000000 5800.000000000000000

result:

ok 24 numbers

Test #7:

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

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.000000000000000 0.000000000000000
0 1 215.999999999999972 245.999999999999972
0 2 449.999999999999829 714.000000000000000
0 3 1083.999999999999773 1113.999999999999773
0 4 1539.999999999999773 1569.999999999999773
0 5 2674.000000000000000 2704.000000000000000
0 6 3408.000000000000000 3438.000...

result:

ok 400 numbers

Test #8:

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

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.000000000000000 0.000000000000000
0 1 215.999999999999972 246.000000000000000
0 2 579.999999999998977 640.000000000000000
0 3 1083.999999999999773 1113.999999999999773
0 4 1539.999999999999773 1569.999999999999773
0 5 2674.000000000000000 2704.000000000000000
0 6 3408.000000000000000 3438.000...

result:

ok 400 numbers

Test #9:

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

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.000000000000000 0.000000000000000
0 1 244.999999999999943 246.000000000000000
0 2 608.999999999999886 640.000000000000000
0 3 1084.000000000000000 1113.999999999999773
0 4 1568.999999999999773 1569.999999999999773
0 5 2703.000000000000000 2704.000000000000000
0 6 3437.000000000000000 3438.000...

result:

ok 400 numbers

Test #10:

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

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.500000000000000 10.500000000000000
1 2 10.500000000000000 10.500000000000000
2 0 10.500000000000000 10.500000000000000

result:

ok 12 numbers

Test #11:

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

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.142857142857142 10.142857142857142
1 2 10.142857142857142 10.142857142857142
2 3 10.142857142857142 10.142857142857142
3 4 10.142857142857142 10.142857142857142
4 5 10.142857142857142 10.142857142857142
5 6 10.142857142857142 10.142857142857142
6 7 10.142857142857142 10.142857142857142
7 0 10...

result:

ok 32 numbers

Test #12:

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

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.000000000000000 11.000000000000000
1 2 10.000000000000000 10.333333333333334
2 3 10.000000000000000 10.333333333333334
3 4 10.000000000000000 10.333333333333334
4 5 10.000000000000000 11.000000000000000
5 6 10.000000000000000 10.333333333333334
6 0 10.000000000000000 10.333333333333334

result:

ok 28 numbers

Test #13:

score: 0
Accepted
time: 23ms
memory: 3944kb

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.172413793102919 793.172413793102692
10 16 726.172413793103601 726.172413793102464
16 29 367.172413793104965 367.172413793102521
29 15 812.172413793104056 812.172413793102464
15 24 959.172413793104397 959.172413793102805
24 2 826.172413793104056 826.172413793102464
2 7 750.172413793102919 75...

result:

ok 400 numbers

Test #14:

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

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 792.999999999999318 793.178571428570876
10 16 726.000000000000227 726.178571428570649
16 29 367.000000000001592 367.178571428570820
29 15 812.000000000001592 812.178571428570876
15 24 959.000000000001819 959.178571428571104
24 2 826.000000000001592 826.178571428570876
2 7 749.999999999999318 75...

result:

ok 400 numbers

Test #15:

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

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.000000000000000 0.000000000000000
0 0 -0.000000000000000 0.000000000000000
0 0 -0.000000000000000 0.000000000000000
0 0 -0.000000000000000 0.000000000000000
0 0 -0.000000000000000 0.000000000000000
0 0 -0.000000000000000 0.000000000000000
0 0 -0.000000000000000 0.000000000000000
0 0 -0.000000...

result:

ok 400 numbers

Test #16:

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

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.000000000000000 0.000000000000000
1 1 -0.000000000000000 0.000000000000000
2 2 -0.000000000000000 0.000000000000000
3 3 -0.000000000000000 0.000000000000000
4 4 -0.000000000000000 0.000000000000000
5 5 -0.000000000000000 0.000000000000000
6 6 -0.000000000000000 0.000000000000000
7 7 -0.000000...

result:

ok 400 numbers

Test #17:

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

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.000000000029104 57999.999999999985448
6 11 10000.000000000041837 9999.999999999998181
7 16 18000.000000000040018 17999.999999999996362
26 6 20000.000000000003638 40000.000000000000000
3 12 18000.000000000040018 17999.999999999996362
6 25 38000.000000000029104 37999.999999999985448
17 0 17...

result:

ok 400 numbers

Test #18:

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

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.999999999978172 28999.999999999978172
6 11 4999.999999999991815 5000.000000000040927
7 16 8999.999999999983629 9000.000000000032742
26 6 19999.999999999956344 40000.000000000000000
3 12 8999.999999999987267 9000.000000000036380
6 25 18999.999999999959982 19000.000000000010914
17 0 16999.9...

result:

ok 400 numbers

Test #19:

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

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.999999999978172 28999.999999999978172
6 11 4999.999999999998181 4999.999999999978172
7 16 9000.000000000003638 8999.999999999983629
26 6 39999.999999999992724 39999.999999999956344
3 12 9000.000000000000000 8999.999999999979991
6 25 19000.000000000000000 18999.999999999981810
17 0 34000.0...

result:

ok 400 numbers

Test #20:

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

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.000000000000000 1310.000000000000000
14 4 1363.000000000000227 2641.999999999999545
14 7 1016.000000000000227 1947.999999999999545
21 28 236.000000000000256 471.999999999999773
0 20 2018.000000000000000 3428.000000000000000
2 1 5565.000000000000000 5896.000000000000000
9 26 5769.0000000000...

result:

ok 400 numbers

Test #21:

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

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.000000000000000 4.999999999999999
13 26 7.000000000000001 7.999999999999999
7 8 11.000000000000000 16.000000000000000
26 4 9.000000000000000 12.000000000000000
8 27 8.000000000000000 10.000000000000000
25 11 3.000000000000000 4.999999999999999
5 17 5.000000000000001 5.000000000000000
27 1 6....

result:

ok 400 numbers

Test #22:

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

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.000000000000000 31.000000000000000
0 16 55.999999999999993 56.999999999999993
21 8 16.500000000000000 19.000000000000000
5 11 31.000000000000000 33.000000000000000
17 1 57.999999999999993 58.999999999999993
19 16 55.000000000000000 55.000000000000000
8 28 46.000000000000000 46.00000000000000...

result:

ok 400 numbers

Test #23:

score: 0
Accepted
time: 125ms
memory: 4436kb

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.999999999999545 491.000000000000000
15 10 936.000000000000000 1226.000000000000455
8 28 600.000000000000227 600.000000000000341
16 5 701.000000000000000 701.000000000000000
11 2 1583.000000000000000 1880.000000000000000
17 21 800.000000000000000 800.000000000000114
18 4 1420.999999999999545...

result:

ok 400 numbers

Test #24:

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

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.000000000010004 4032.999999999997726
17 16 6952.000000000004547 7034.000000000000909
2 20 1801.000000000008640 1800.999999999995907
5 19 2702.000000000000909 2701.999999999995453
20 23 5326.000000000010914 5325.999999999997272
11 0 5382.000000000002728 5381.999999999995453
9 22 5816.999999...

result:

ok 400 numbers

Test #25:

score: 0
Accepted
time: 240ms
memory: 4388kb

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.000000000000142 50.999999999999901
10 4 55.000000000000142 54.999999999999680
24 3 51.000000000000142 50.999999999999901
19 21 69.000000000000142 68.999999999999758
6 27 11.000000000000114 11.000000000000005
6 22 45.000000000000092 44.999999999999922
7 4 67.999999999999986 67.999999999999844...

result:

ok 400 numbers

Test #26:

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

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.000000000000455 3296.000000000000000
6 17 528.000000000000114 527.999999999999773
4 15 3951.000000000000000 3951.000000000000000
1 10 1500.000000000000682 1499.999999999999545
15 25 3213.000000000000000 3213.000000000000000
1 16 83.000000000000256 82.999999999999545
19 14 5247.0000000000000...

result:

ok 400 numbers

Test #27:

score: 0
Accepted
time: 199ms
memory: 4376kb

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.000000000000000 6819.000000000000000
6 5 7003.000000000000000 7003.000000000000000
27 0 5367.000000000000000 5367.000000000000000
2 16 1307.000000000000000 1307.000000000000000
3 28 1965.000000000000000 1965.000000000000000
17 10 1442.000000000000000 1442.000000000000000
7 28 4092.0000000...

result:

ok 400 numbers

Test #28:

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

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.000000000000000 4506.000000000000000
12 23 802.000000000000000 1091.000000000000000
17 28 2804.000000000000000 3609.000000000000000
22 7 595.000000000000000 1190.000000000000000
27 10 1225.000000000000000 1658.000000000000000
7 29 861.000000000000000 1722.000000000000000
5 0 875.0000000000...

result:

ok 400 numbers

Test #29:

score: 0
Accepted
time: 269ms
memory: 4212kb

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.000000000000000 1974.000000000000000
21 29 933.000000000000000 1805.000000000000000
21 20 434.000000000000000 868.000000000000000
22 28 1915.000000000000000 3144.000000000000000
11 23 877.000000000000000 1754.000000000000000
25 13 1033.000000000000000 1110.000000000000000
11 8 405.00000000...

result:

ok 400 numbers

Test #30:

score: 0
Accepted
time: 322ms
memory: 4232kb

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.000000000000000 0.000000000000000
9 16 25.000000000000000 47.000000000000000
25 5 526.000000000000000 1037.000000000000000
8 24 494.000000000000000 586.000000000000000
10 23 935.000000000000000 1405.000000000000000
13 20 411.000000000000000 411.000000000000000
7 11 792.000000000000000 1472....

result:

ok 400 numbers

Test #31:

score: 0
Accepted
time: 362ms
memory: 4260kb

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.000000000000000 19.000000000000000
7 18 17.000000000000000 21.000000000000000
10 15 15.000000000000000 16.000000000000000
10 7 10.999999999999998 22.000000000000000
25 13 18.000000000000000 20.000000000000000
29 15 3.000000000000000 4.000000000000000
11 5 8.000000000000000 8.000000000000000
...

result:

ok 400 numbers

Test #32:

score: 0
Accepted
time: 425ms
memory: 4424kb

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 683.999999999999886 1367.999999999999773
12 25 2584.000000000000000 2584.000000000000000
17 23 1273.000000000000000 1307.000000000000000
13 2 912.999999999999773 946.999999999999773
8 16 500.000000000000000 572.000000000000000
25 19 2299.000000000000000 2299.000000000000000
14 4 1418.0000000000...

result:

ok 400 numbers

Test #33:

score: 0
Accepted
time: 544ms
memory: 4500kb

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.000000000000682 1087.999999999999773
12 28 1072.000000000001592 1272.000000000000455
15 24 1976.000000000000227 1976.000000000000227
4 12 1025.000000000000227 1301.000000000000909
18 3 2082.000000000002728 2082.000000000000455
5 20 855.000000000000000 1236.000000000000682
2 6 994.000000000...

result:

ok 400 numbers

Test #34:

score: 0
Accepted
time: 540ms
memory: 4496kb

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.000000000000000 7.000000000000000
18 19 3.000000000000000 3.000000000000000
26 26 -0.000000000000000 0.000000000000000
18 17 5.000000000000000 5.000000000000000
2 19 6.000000000000000 6.000000000000000
10 2 4.000000000000000 4.000000000000000
16 21 3.000000000000000 3.000000000000000
23 28 1....

result:

ok 400 numbers

Test #35:

score: 0
Accepted
time: 605ms
memory: 4496kb

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.000000000000000 6.999999999999997
5 29 4.000000000000002 6.999999999999993
23 3 8.000000000000004 10.999999999999986
11 10 4.000000000000004 3.999999999999993
27 4 4.000000000000003 3.999999999999996
5 0 5.000000000000000 4.999999999999997
21 21 -0.000000000000000 0.000000000000000
29 27 5.99...

result:

ok 400 numbers

Test #36:

score: 0
Accepted
time: 573ms
memory: 4436kb

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.000000000000002 10.999999999999998
25 6 4.000000000000004 3.999999999999999
6 12 13.000000000000000 12.999999999999996
20 23 9.000000000000000 8.999999999999996
4 12 14.000000000000004 14.000000000000000
23 23 -0.000000000000000 0.000000000000000
15 9 3.000000000000006 2.999999999999992
0 2...

result:

ok 400 numbers

Test #37:

score: 0
Accepted
time: 724ms
memory: 4408kb

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 12.999999999999998 15.000000000000000
22 2 8.000000000000004 8.000000000000007
20 4 12.000000000000004 12.000000000000004
9 27 4.000000000000002 3.999999999999999
21 6 9.999999999999993 10.999999999999993
13 17 7.000000000000009 6.999999999999999
28 9 3.000000000000001 2.999999999999996
16 13 ...

result:

ok 400 numbers

Test #38:

score: 0
Accepted
time: 609ms
memory: 4388kb

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.000000000000000 17.999999999999986
3 4 50.000000000000050 50.000000000000000
28 8 40.000000000000000 47.000000000000000
20 23 35.000000000000007 49.999999999999972
0 9 27.000000000000004 47.000000000000007
10 20 47.000000000000000 74.000000000000000
26 3 9.000000000000012 8.999999999999982
...

result:

ok 400 numbers

Test #39:

score: 0
Accepted
time: 671ms
memory: 4424kb

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.000000000000000 114.999999999999957
24 10 111.000000000000071 110.999999999999886
23 12 118.000000000000071 117.999999999999957
21 7 202.000000000000000 201.999999999999972
21 19 94.000000000000057 93.999999999999872
17 11 83.000000000000028 82.999999999999972
14 4 148.000000000000057 147.9...

result:

ok 400 numbers

Test #40:

score: 0
Accepted
time: 672ms
memory: 4456kb

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.000000000010459 1914.999999999976353
21 18 946.000000000003752 1272.999999999984993
2 13 1925.000000000002956 1924.999999999997272
2 20 136.000000000013955 135.999999999977433
20 6 1900.000000000021373 1899.999999999996135
3 27 904.000000000000227 904.000000000000227
17 9 1269.000000000017...

result:

ok 400 numbers

Test #41:

score: 0
Accepted
time: 701ms
memory: 4456kb

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.000000000060936 3729.999999999999091
11 7 146.000000000054854 145.999999999955946
23 6 3925.000000000005457 3924.999999999844931
6 15 1843.000000000000455 1842.999999999938382
26 18 1712.000000000026375 1711.999999999902684
0 10 1206.000000000072077 1205.999999999877218
29 7 2563.00000000...

result:

ok 400 numbers

Test #42:

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

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.000000000000000 56.999999999999979
9 17 8.000000000000021 8.999999999999980
24 3 25.000000000000007 25.999999999999957
15 25 18.999999999999996 18.999999999999996
11 29 24.000000000000039 25.999999999999922
10 2 21.000000000000000 21.999999999999961
17 9 3.000000000000026 3.999999999999981
3...

result:

ok 400 numbers

Test #43:

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

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.500000000000008 7.500000000000002
12 0 24.500000000000004 25.500000000000000
6 28 25.500000000000004 30.999999999999993
29 3 9.500000000000002 10.000000000000000
5 28 49.000000000000007 54.500000000000000
19 2 22.000000000000011 22.999999999999993
16 25 22.500000000000000 22.500000000000000
9 ...

result:

ok 400 numbers

Test #44:

score: 0
Accepted
time: 207ms
memory: 4372kb

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.000000000000000 14.000000000000000
21 8 42.000000000000000 43.000000000000000
4 8 4.999999999999999 6.000000000000000
10 16 33.000000000000007 34.000000000000000
13 17 9.000000000000000 10.999999999999996
21 6 32.999999999999993 32.999999999999993
13 0 32.000000000000007 33.999999999999993
0 ...

result:

ok 400 numbers

Test #45:

score: 0
Accepted
time: 216ms
memory: 4380kb

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.500000000000000 44.333333333333307
5 3 19.000000000000007 19.999999999999993
9 13 22.000000000000007 24.333333333333314
15 18 22.333333333333343 22.499999999999993
0 5 33.333333333333364 35.499999999999993
9 26 23.333333333333350 23.499999999999986
6 29 39.000000000000000 40.666666666666650...

result:

ok 400 numbers

Test #46:

score: 0
Accepted
time: 634ms
memory: 4452kb

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.999999999999996 22.499999999999996
18 24 6.999999999999999 6.999999999999998
4 13 8.000000000000000 8.499999999999998
4 24 17.999999999999993 30.999999999999993
7 17 1.000000000000000 2.000000000000001
25 10 11.000000000000000 18.000000000000000
6 22 9.000000000000002 9.000000000000002
24 2...

result:

ok 400 numbers

Test #47:

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

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.000000000000000 8.000000000000000
10 19 9.000000000000000 9.000000000000000
4 15 18.000000000000000 20.000000000000000
24 2 8.000000000000000 15.000000000000000
7 20 14.000000000000000 15.000000000000000
2 19 7.000000000000000 7.000000000000000
9 10 12.000000000000000 18.500000000000000
25 27 ...

result:

ok 400 numbers

Test #48:

score: 0
Accepted
time: 588ms
memory: 4416kb

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.000000000000003 3.000000000000000
29 14 7.000000000000002 10.000000000000000
11 27 12.000000000000000 12.000000000000000
0 24 14.000000000000000 18.000000000000000
12 28 1.000000000000000 2.000000000000000
28 25 10.000000000000000 10.999999999999998
3 29 12.000000000000000 13.000000000000000
...

result:

ok 400 numbers

Test #49:

score: 0
Accepted
time: 559ms
memory: 4420kb

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.000000000000000 24.000000000000004
7 6 6.000000000000000 7.000000000000004
12 16 6.999999999999999 9.000000000000002
22 24 10.999999999999996 21.000000000000000
3 9 18.999999999999993 25.000000000000004
15 21 4.000000000000000 7.000000000000000
17 29 16.999999999999996 24.000000000000000
20 ...

result:

ok 400 numbers

Test #50:

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

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.999999999999996 14.666666666666666
12 26 18.000000000000004 26.000000000000007
7 17 15.000000000000000 15.000000000000002
27 19 9.000000000000000 12.666666666666670
4 29 6.000000000000000 10.000000000000000
28 28 -0.000000000000000 0.000000000000000
18 8 7.999999999999999 8.666666666666666
21 ...

result:

ok 400 numbers

Test #51:

score: 0
Accepted
time: 549ms
memory: 4408kb

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.000000000000000 20.000000000000000
21 1 19.000000000000004 23.000000000000000
24 10 14.999999999999998 16.000000000000004
26 26 -0.000000000000000 0.000000000000000
9 24 10.000000000000000 16.999999999999993
26 17 10.999999999999998 15.999999999999995
5 16 8.000000000000000 8.999999999999998
...

result:

ok 400 numbers

Test #52:

score: 0
Accepted
time: 440ms
memory: 4516kb

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.000000000007276 6892.999999999997272
17 12 3141.000000000005002 5669.999999999994543
28 7 1941.000000000000455 3528.999999999998636
28 4 4529.000000000002728 4947.999999999998181
23 29 1860.000000000001592 3719.999999999999545
17 28 3299.000000000003638 5050.499999999994543
5 14 3416.00000...

result:

ok 400 numbers

Test #53:

score: 0
Accepted
time: 415ms
memory: 4288kb

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.999999999999773 1070.000000000000000
24 10 1404.999999999999545 1881.999999999999545
24 15 1467.000000000000455 2934.000000000000000
11 16 2462.999999999999545 2547.999999999999545
4 15 1507.000000000000000 1892.999999999999773
14 4 1061.999999999999773 1649.000000000000000
19 25 1236.99999...

result:

ok 400 numbers

Test #54:

score: 0
Accepted
time: 386ms
memory: 4216kb

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 1569.999999999999545 3140.000000000000000
22 25 2444.000000000000000 4888.000000000001819
22 10 4024.000000000000000 7119.000000000000909
8 22 1567.000000000000000 3134.000000000000909
3 17 1903.999999999998863 3551.000000000000455
18 9 2453.000000000000000 4906.000000000001819
24 11 1803.999999...

result:

ok 400 numbers