QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#546765#4370. Road TimesPhantomThresholdAC ✓2973ms5372kbC++174.9kb2024-09-04 13:11:062024-09-04 13:11:06

Judging History

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

  • [2024-09-04 13:11:06]
  • 评测
  • 测评结果:AC
  • 用时:2973ms
  • 内存:5372kb
  • [2024-09-04 13:11:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using db = long double;
const db eps = 1e-4;
int sgn(db x) { return x < -eps ? -1 : x > eps; }
int cmp(db k1,db k2){return sgn(k1-k2);}
namespace LP {
	const int N = 105, M = 505;
	int n, m; // n : 变量个数,m : 约束个数
	db a[M + N][N], x[N + M];
	// 约束:对于 1 <= i <= m : a[i][0] + \sum_j x[j] * a[i][j] >= 0
	// x[j] >= 0
	// 最大化 \sum_j x[j] * a[0][j]
	int id[N + M];
	void pivot(int p, int o) {
		std::swap(id[p], id[o + n]);
		db w = -a[o][p];
		for(int i = 0;i <= n;++i) a[o][i] /= w;
		a[o][p] = -1 / w;
		for(int i = 0;i <= m;++i) if(sgn(a[i][p]) && i != o) {
			db w = a[i][p]; a[i][p] = 0;
			for(int j = 0;j <= n;++j) a[i][j] += w * a[o][j];
		}
	}
	db solve() { // nan : 无解,inf : 无界,否则返回最大值
		for(int i = 1;i <= n + m;++i) id[i] = i;
		for(;;) {
			int p = 0, min = 1;
			for(int i = 1;i <= m;++i) {
				if(a[i][0] < a[min][0]) min = i;
			}
			if(a[min][0] >= -eps) break;
			for(int i = 1;i <= n;++i) if(a[min][i] > eps && id[i] > id[p]) {
				p = i;
			}
			if(!p) return nan("");
			pivot(p, min);
		}
		for(;;) {
			int p = 1;
			for(int i = 1;i <= n;++i) if(a[0][i] > a[0][p]) p = i;
			if(a[0][p] < eps) break;
			db min = INFINITY; int o = 0;
			for(int i = 1;i <= m;++i) if(a[i][p] < -eps) {
				db w = -a[i][0] / a[i][p]; int d = sgn(w - min);
				if(d < 0 || !d && id[i] > id[o]) o = i, min = w;
			}
			if(!o) return INFINITY;
			pivot(p, o);
		}
		for(int i = 1;i <= m;++i) x[id[i + n]] = a[i][0];
		return a[0][0];
	}
}

const db INF=1e18;
db g[35][35];
int idcnt=0;
int id[35][35];
db dis[35][35];

int main(){
	ios_base::sync_with_stdio(false);
	cerr << fixed << setprecision(4);
	cout << fixed << setprecision(12);
	
	int n;
	cin >> n;
	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			int x;
			cin >> x;
			if (x!=-1) g[i][j]=x;
			else g[i][j]=INF;
			if (x>0) id[i][j]=++idcnt;
		}
	}
	
	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			dis[i][j]=g[i][j];
		}
	}
	for (int k=0;k<n;k++){
		for (int i=0;i<n;i++){
			for (int j=0;j<n;j++){
				if (k==i || i==j || j==k) continue;
				dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);	
			}
		}
	}
	
//	for (int i=0;i<n;i++){
//		for (int j=0;j<n;j++){
//			cerr << dis[i][j] << " ";
//		}
//		cerr << endl;
//	}
//	for (int i=0;i<n;i++){
//		for (int j=0;j<n;j++){
//			cerr << id[i][j] << " ";
//		}
//		cerr << endl;
//	}
	
	vector<vector<db>> restrict;
	
	for (int i=1;i<=idcnt;i++){
		{
			vector<db> tmp(idcnt+1);
			tmp[0]=-1;
			tmp[i]=1;
			restrict.emplace_back(tmp);
		}
		{
			vector<db> tmp(idcnt+1);
			tmp[0]=2;
			tmp[i]=-1;
			restrict.emplace_back(tmp);
		}
	}
	
	int r;
	cin >> r;
	for (int cc=1;cc<=r;cc++){
		int st,ed;
		db d;
		cin	>> st >> ed >> d;
		vector<int> path;
		for (int now=st;now!=ed;){
			path.emplace_back(now);
			int nxt=0;
			for (int i=0;i<n;i++) if (i!=now && cmp(g[now][i]+dis[i][ed],dis[now][ed])==0) nxt=i;
			now=nxt;
		}
		path.emplace_back(ed);
		
//		for (auto x:path) cerr << x << "->";
//		cerr << endl;
		
		vector<db> tmp(idcnt+1);
		tmp[0]=-d;
		int path_sz=(int)path.size();
		for (int i=1;i<path_sz;i++){
			int u=path[i-1];
			int v=path[i];
			tmp[id[u][v]]=g[u][v];
		}
		restrict.emplace_back(tmp);
		
		for (auto &x:tmp) x=x*(-1);
		restrict.emplace_back(tmp);
	}
	
//	cerr << "--------restrict----------" << endl;
//	for (auto &v:restrict){
//		for (auto x:v) cerr << x << " ";
//		cerr << endl;	
//	}
//	cerr << "------------------" << endl;
	
	int Q;
	cin >> Q;
	for (;Q--;){
		int st,ed;
		cin	>> st >> ed;
		
		vector<int> path;
		for (int now=st;now!=ed;){
		//	cerr << "now : " << now << endl;
			path.emplace_back(now);
			int nxt=0;
			for (int i=0;i<n;i++) if (i!=now && cmp(g[now][i]+dis[i][ed],dis[now][ed])==0) nxt=i;
			now=nxt;
		}
		path.emplace_back(ed);
		
		vector<db> tmp(idcnt+1);
		int path_sz=(int)path.size();
		for (int i=1;i<path_sz;i++){
			int u=path[i-1];
			int v=path[i];
			tmp[id[u][v]]=g[u][v];
		}
		
//		for (auto x:path) cerr << x << "->";
//		cerr << endl;
//		for (auto x:tmp) cerr << x << " ";
//		cerr << endl;
		
		db ans1=0,ans2=0;
		{
			memset(LP::a,0,sizeof(LP::a));
			memset(LP::x,0,sizeof(LP::x));
			memset(LP::id,0,sizeof(LP::id));
			LP::n=idcnt;
			LP::m=0;
			for (auto &vec:restrict){
				++LP::m;
				for (int i=0;i<=idcnt;i++) LP::a[LP::m][i]=vec[i];
			}
			for (int i=0;i<=idcnt;i++) LP::a[0][i]=tmp[i]*(-1);
			ans1=LP::solve()*(-1);
		}
		{
			memset(LP::a,0,sizeof(LP::a));
			memset(LP::x,0,sizeof(LP::x));
			memset(LP::id,0,sizeof(LP::id));
			LP::n=idcnt;
			LP::m=0;
			for (auto &vec:restrict){
				++LP::m;
				for (int i=0;i<=idcnt;i++) LP::a[LP::m][i]=vec[i];
			}
			for (int i=0;i<=idcnt;i++) LP::a[0][i]=tmp[i];
			ans2=LP::solve();
		}
		cout << st << " " << ed << " " << ans1 << " " << ans2 << "\n";
	}
	return 0;	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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.000000000000 80.000000000000
1 2 40.000000000000 70.000000000000
1 0 55.000000000000 110.000000000000

result:

ok 12 numbers

Test #2:

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

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.000000000000 50.000000000000
1 2 40.000000000000 40.000000000000
1 0 55.000000000000 110.000000000000

result:

ok 12 numbers

Test #3:

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

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.000000000000 100.000000000000
1 2 80.000000000000 80.000000000000
1 0 55.000000000000 110.000000000000

result:

ok 12 numbers

Test #4:

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

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.000000000000 1920.000000000000
2 1 1800.000000000000 1820.000000000000
1 4 1980.000000000000 2000.000000000000
4 3 1980.000000000000 2000.000000000000
4 5 1880.000000000000 1900.000000000000
0 5 5800.000000000000 5800.000000000000

result:

ok 24 numbers

Test #5:

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

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.000000000000 1920.000000000000
2 1 1820.000000000000 1820.000000000000
1 4 2000.000000000000 2000.000000000000
4 3 1980.000000000000 1980.000000000000
4 5 1880.000000000000 1880.000000000000
0 5 5800.000000000000 5800.000000000000

result:

ok 24 numbers

Test #6:

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

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.000000000000 1900.000000000000
2 1 1800.000000000000 1800.000000000000
1 4 2000.000000000000 2000.000000000000
4 3 2000.000000000000 2000.000000000000
4 5 1900.000000000000 1900.000000000000
0 5 5800.000000000000 5800.000000000000

result:

ok 24 numbers

Test #7:

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

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.000000000000 0.000000000000
0 1 216.000000000000 246.000000000000
0 2 450.000000000000 714.000000000000
0 3 1084.000000000000 1114.000000000000
0 4 1540.000000000000 1570.000000000000
0 5 2674.000000000000 2704.000000000000
0 6 3408.000000000000 3438.000000000000
0 7 4298.000000000000 4358.000...

result:

ok 400 numbers

Test #8:

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

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.000000000000 0.000000000000
0 1 216.000000000000 246.000000000000
0 2 580.000000000000 640.000000000000
0 3 1084.000000000000 1114.000000000000
0 4 1540.000000000000 1570.000000000000
0 5 2674.000000000000 2704.000000000000
0 6 3408.000000000000 3438.000000000000
0 7 4298.000000000000 4358.000...

result:

ok 400 numbers

Test #9:

score: 0
Accepted
time: 3ms
memory: 4968kb

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.000000000000 0.000000000000
0 1 245.000000000000 246.000000000000
0 2 609.000000000000 640.000000000000
0 3 1084.000000000000 1114.000000000000
0 4 1569.000000000000 1570.000000000000
0 5 2703.000000000000 2704.000000000000
0 6 3437.000000000000 3438.000000000000
0 7 4327.000000000000 4358.000...

result:

ok 400 numbers

Test #10:

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

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.500000000000 10.500000000000
1 2 10.500000000000 10.500000000000
2 0 10.500000000000 10.500000000000

result:

ok 12 numbers

Test #11:

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

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.142857142857 10.142857142857
1 2 10.142857142857 10.142857142857
2 3 10.142857142857 10.142857142857
3 4 10.142857142857 10.142857142857
4 5 10.142857142857 10.142857142857
5 6 10.142857142857 10.142857142857
6 7 10.142857142857 10.142857142857
7 0 10.142857142857 10.142857142857

result:

ok 32 numbers

Test #12:

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

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.000000000000 11.000000000000
1 2 10.000000000000 10.333333333333
2 3 10.000000000000 10.333333333333
3 4 10.000000000000 10.333333333333
4 5 10.000000000000 11.000000000000
5 6 10.000000000000 10.333333333333
6 0 10.000000000000 10.333333333333

result:

ok 28 numbers

Test #13:

score: 0
Accepted
time: 38ms
memory: 4964kb

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.172413793103 793.172413793103
10 16 726.172413793103 726.172413793103
16 29 367.172413793103 367.172413793103
29 15 812.172413793103 812.172413793103
15 24 959.172413793103 959.172413793103
24 2 826.172413793103 826.172413793103
2 7 750.172413793103 750.172413793103
7 18 865.172413793103 86...

result:

ok 400 numbers

Test #14:

score: 0
Accepted
time: 29ms
memory: 5060kb

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.000000000000 793.178571428571
10 16 726.000000000000 726.178571428571
16 29 367.000000000000 367.178571428571
29 15 812.000000000000 812.178571428571
15 24 959.000000000000 959.178571428571
24 2 826.000000000000 826.178571428571
2 7 750.000000000000 750.178571428571
7 18 865.000000000000 86...

result:

ok 400 numbers

Test #15:

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

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.000000000000 0.000000000000
0 0 0.000000000000 0.000000000000
0 0 0.000000000000 0.000000000000
0 0 0.000000000000 0.000000000000
0 0 0.000000000000 0.000000000000
0 0 0.000000000000 0.000000000000
0 0 0.000000000000 0.000000000000
0 0 0.000000000000 0.000000000000
0 0 0.000000000000 0.0000000...

result:

ok 400 numbers

Test #16:

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

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.000000000000 0.000000000000
1 1 0.000000000000 0.000000000000
2 2 0.000000000000 0.000000000000
3 3 0.000000000000 0.000000000000
4 4 0.000000000000 0.000000000000
5 5 0.000000000000 0.000000000000
6 6 0.000000000000 0.000000000000
7 7 0.000000000000 0.000000000000
8 8 0.000000000000 0.0000000...

result:

ok 400 numbers

Test #17:

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

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.000000000000 58000.000000000000
6 11 10000.000000000000 10000.000000000000
7 16 18000.000000000000 18000.000000000000
26 6 20000.000000000000 40000.000000000000
3 12 18000.000000000000 18000.000000000000
6 25 38000.000000000000 38000.000000000000
17 0 17000.000000000000 34000.000000000000...

result:

ok 400 numbers

Test #18:

score: 0
Accepted
time: 25ms
memory: 5144kb

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.000000000000 29000.000000000000
6 11 5000.000000000000 5000.000000000000
7 16 9000.000000000000 9000.000000000000
26 6 20000.000000000000 40000.000000000000
3 12 9000.000000000000 9000.000000000000
6 25 19000.000000000000 19000.000000000000
17 0 17000.000000000000 34000.000000000000
25 27...

result:

ok 400 numbers

Test #19:

score: 0
Accepted
time: 28ms
memory: 4948kb

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.000000000000 29000.000000000000
6 11 5000.000000000000 5000.000000000000
7 16 9000.000000000000 9000.000000000000
26 6 40000.000000000000 40000.000000000000
3 12 9000.000000000000 9000.000000000000
6 25 19000.000000000000 19000.000000000000
17 0 34000.000000000000 34000.000000000000
25 27...

result:

ok 400 numbers

Test #20:

score: 0
Accepted
time: 41ms
memory: 5040kb

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.000000000000 1310.000000000000
14 4 1363.000000000000 2642.000000000000
14 7 1016.000000000000 1948.000000000000
21 28 236.000000000000 472.000000000000
0 20 2018.000000000000 3428.000000000000
2 1 5565.000000000000 5896.000000000000
9 26 5769.000000000000 6091.000000000000
4 20 1551.00000...

result:

ok 400 numbers

Test #21:

score: 0
Accepted
time: 50ms
memory: 5008kb

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.000000000000 5.000000000000
13 26 7.000000000000 8.000000000000
7 8 11.000000000000 16.000000000000
26 4 9.000000000000 12.000000000000
8 27 8.000000000000 10.000000000000
25 11 3.000000000000 5.000000000000
5 17 5.000000000000 5.000000000000
27 1 6.000000000000 7.000000000000
3 5 6.00000000...

result:

ok 400 numbers

Test #22:

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

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.000000000000 31.000000000000
0 16 56.000000000000 57.000000000000
21 8 16.500000000000 19.000000000000
5 11 31.000000000000 33.000000000000
17 1 58.000000000000 59.000000000000
19 16 55.000000000000 55.000000000000
8 28 46.000000000000 46.000000000000
10 14 8.000000000000 14.000000000000
16 ...

result:

ok 400 numbers

Test #23:

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

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.000000000000 491.000000000000
15 10 936.000000000000 1226.000000000000
8 28 600.000000000000 600.000000000000
16 5 701.000000000000 701.000000000000
11 2 1583.000000000000 1880.000000000000
17 21 800.000000000000 800.000000000000
18 4 1421.000000000000 1847.000000000000
27 7 648.00000000000...

result:

ok 400 numbers

Test #24:

score: 0
Accepted
time: 181ms
memory: 5000kb

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.000000000000 4033.000000000000
17 16 6952.000000000000 7034.000000000000
2 20 1801.000000000000 1801.000000000000
5 19 2702.000000000000 2702.000000000000
20 23 5326.000000000000 5326.000000000000
11 0 5382.000000000000 5382.000000000000
9 22 5817.000000000000 5974.000000000000
8 9 7184.00...

result:

ok 400 numbers

Test #25:

score: 0
Accepted
time: 967ms
memory: 5052kb

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.000000000000 51.000000000000
10 4 55.000000000000 55.000000000000
24 3 51.000000000000 51.000000000000
19 21 69.000000000000 69.000000000000
6 27 11.000000000000 11.000000000000
6 22 45.000000000000 45.000000000000
7 4 68.000000000000 68.000000000000
1 4 50.000000000000 50.000000000000
20 15...

result:

ok 400 numbers

Test #26:

score: 0
Accepted
time: 431ms
memory: 5000kb

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.000000065197 3295.999999973726
6 17 527.999989751654 527.999989725731
4 15 3951.000000026274 3950.999999961583
1 10 1499.999999996098 1499.999999969637
15 25 3213.000000025920 3212.999999999941
1 16 83.000000039286 82.999999974077
19 14 5247.000000000433 5246.999999926966
28 22 3127.0000000...

result:

ok 400 numbers

Test #27:

score: 0
Accepted
time: 862ms
memory: 5056kb

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.999999905737 6818.999999999890
6 5 7002.999999924108 7002.999999924049
27 0 5366.999999905400 5366.999999999970
2 16 1306.999999842867 1307.000000032007
3 28 1964.999999901837 1964.999999999886
17 10 1442.000000000000 1442.000000094263
7 28 4092.000000000430 4092.000000098369
20 12 3446.0...

result:

ok 400 numbers

Test #28:

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

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.000000000000 4506.000000000000
12 23 802.000000000000 1091.000000000000
17 28 2804.000000000000 3609.000000000000
22 7 595.000000000000 1190.000000000000
27 10 1225.000000000000 1658.000000000000
7 29 861.000000000000 1722.000000000000
5 0 875.000000000000 1687.000000000000
16 26 1676.0000...

result:

ok 400 numbers

Test #29:

score: 0
Accepted
time: 51ms
memory: 5224kb

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.000000000000 1974.000000000000
21 29 933.000000000000 1805.000000000000
21 20 434.000000000000 868.000000000000
22 28 1915.000000000000 3144.000000000000
11 23 877.000000000000 1754.000000000000
25 13 1033.000000000000 1110.000000000000
11 8 405.000000000000 810.000000000000
23 19 968.0000...

result:

ok 400 numbers

Test #30:

score: 0
Accepted
time: 86ms
memory: 5156kb

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.000000000000 0.000000000000
9 16 25.000000000000 47.000000000000
25 5 526.000000000000 1037.000000000000
8 24 494.000000000000 586.000000000000
10 23 935.000000000000 1405.000000000000
13 20 411.000000000000 411.000000000000
7 11 792.000000000000 1472.000000000000
6 26 781.000000000000 1233....

result:

ok 400 numbers

Test #31:

score: 0
Accepted
time: 113ms
memory: 5228kb

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.000000000000 19.000000000000
7 18 17.000000000000 21.000000000000
10 15 15.000000000000 16.000000000000
10 7 11.000000000000 22.000000000000
25 13 18.000000000000 20.000000000000
29 15 3.000000000000 4.000000000000
11 5 8.000000000000 8.000000000000
28 12 24.000000000000 25.000000000000
5 19...

result:

ok 400 numbers

Test #32:

score: 0
Accepted
time: 359ms
memory: 5144kb

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.000000000000 1368.000000000000
12 25 2584.000000000000 2584.000000000000
17 23 1273.000000000000 1307.000000000000
13 2 913.000000000000 947.000000000000
8 16 500.000000000000 572.000000000000
25 19 2299.000000000000 2299.000000000000
14 4 1418.000000000000 1418.000000000000
23 17 3155.0000...

result:

ok 400 numbers

Test #33:

score: 0
Accepted
time: 448ms
memory: 5248kb

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.000000000000 1088.000000000000
12 28 1072.000000000003 1272.000000000003
15 24 1976.000000000000 1976.000000000000
4 12 1025.000000000000 1301.000000000000
18 3 2082.000000000033 2082.000000000033
5 20 855.000000000000 1236.000000000000
2 6 994.000000000001 1409.000000000001
27 19 2924.000...

result:

ok 400 numbers

Test #34:

score: 0
Accepted
time: 697ms
memory: 5212kb

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.000000000000 7.000000000000
18 19 3.000000000000 3.000000000000
26 26 0.000000000000 0.000000000000
18 17 5.000000000000 5.000000000000
2 19 6.000000000000 6.000000000000
10 2 4.000000000000 4.000000000000
16 21 3.000000000000 3.000000000000
23 28 1.000000000000 2.000000000000
24 14 4.0000000...

result:

ok 400 numbers

Test #35:

score: 0
Accepted
time: 489ms
memory: 5244kb

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.000000000000 7.000000000000
5 29 4.000000000000 7.000000000000
23 3 8.000000000000 11.000000000000
11 10 4.000000000000 4.000000000000
27 4 4.000000000000 4.000000000000
5 0 5.000000000000 5.000000000000
21 21 0.000000000000 0.000000000000
29 27 6.000000000000 6.000000000000
7 17 6.0000000000...

result:

ok 400 numbers

Test #36:

score: 0
Accepted
time: 926ms
memory: 5372kb

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.000000000000 11.000000000000
25 6 4.000000000000 4.000000000000
6 12 13.000000000000 13.000000000000
20 23 9.000000000000 9.000000000000
4 12 14.000000000000 14.000000000000
23 23 0.000000000000 0.000000000000
15 9 3.000000000000 3.000000000000
0 28 6.000000000000 6.000000000000
7 29 3.0000...

result:

ok 400 numbers

Test #37:

score: 0
Accepted
time: 930ms
memory: 5212kb

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.000000000000 15.000000000000
22 2 8.000000000000 8.000000000000
20 4 12.000000000000 12.000000000000
9 27 4.000000000000 4.000000000000
21 6 10.000000000000 11.000000000000
13 17 7.000000000000 7.000000000000
28 9 3.000000000000 3.000000000000
16 13 16.000000000000 16.000000000000
9 4 8.000...

result:

ok 400 numbers

Test #38:

score: 0
Accepted
time: 1231ms
memory: 5268kb

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.000000000000 18.000000000000
3 4 50.000000000000 50.000000000000
28 8 40.000000000000 47.000000000000
20 23 35.000000000000 50.000000000000
0 9 27.000000000000 47.000000000000
10 20 47.000000000000 74.000000000000
26 3 9.000000000000 9.000000000000
21 2 29.000000000000 29.000000000000
1 18 ...

result:

ok 400 numbers

Test #39:

score: 0
Accepted
time: 2973ms
memory: 5232kb

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.000000000000 115.000000000000
24 10 111.000000000000 111.000000000000
23 12 118.000000000000 118.000000000000
21 7 202.000000000000 202.000000000000
21 19 94.000000000000 94.000000000000
17 11 83.000000000000 83.000000000000
14 4 148.000000000000 148.000000000000
2 8 95.000000000000 95.0000...

result:

ok 400 numbers

Test #40:

score: 0
Accepted
time: 1812ms
memory: 5200kb

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.000000000716 1914.999999999284
21 18 946.000000000716 1272.999999999284
2 13 1925.000000000098 1924.999999999198
2 20 136.000000000102 136.000000000000
20 6 1900.000000000358 1899.999999999284
3 27 904.000000000000 904.000000000000
17 9 1269.000000000190 1682.999999999593
24 23 1153.000000...

result:

ok 400 numbers

Test #41:

score: 0
Accepted
time: 1654ms
memory: 5188kb

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.999999999999 3729.999999999999
11 7 146.000000000000 146.000000000000
23 6 3925.000000000000 3925.000000000000
6 15 1843.000000000000 1843.000000000000
26 18 1712.000000000000 1712.000000000000
0 10 1206.000000000000 1206.000000000354
29 7 2563.000000000001 2563.000000000179
26 24 2103.99...

result:

ok 400 numbers

Test #42:

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

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.000000000000 57.000000000000
9 17 8.000000000000 9.000000000000
24 3 25.000000000000 26.000000000000
15 25 19.000000000000 19.000000000000
11 29 24.000000000000 26.000000000000
10 2 21.000000000000 22.000000000000
17 9 3.000000000000 4.000000000000
3 26 9.000000000000 10.000000000000
10 13 3...

result:

ok 400 numbers

Test #43:

score: 0
Accepted
time: 374ms
memory: 4996kb

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.500000000000 7.500000000000
12 0 24.500000000000 25.500000000000
6 28 25.500000000000 31.000000000000
29 3 9.500000000000 10.000000000000
5 28 49.000000000000 54.500000000000
19 2 22.000000000000 23.000000000000
16 25 22.500000000000 22.500000000000
9 12 15.500000000000 16.000000000000
22 4 8....

result:

ok 400 numbers

Test #44:

score: 0
Accepted
time: 189ms
memory: 5120kb

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.000000000000 14.000000000000
21 8 42.000000000000 43.000000000000
4 8 5.000000000000 6.000000000000
10 16 33.000000000000 34.000000000000
13 17 9.000000000000 11.000000000000
21 6 33.000000000000 33.000000000000
13 0 32.000000000000 34.000000000000
0 24 16.000000000000 17.000000000000
23 14 3...

result:

ok 400 numbers

Test #45:

score: 0
Accepted
time: 360ms
memory: 5152kb

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.500000000000 44.333333333333
5 3 19.000000000000 20.000000000000
9 13 22.000000000000 24.333333333333
15 18 22.333333333333 22.500000000000
0 5 33.333333333333 35.500000000000
9 26 23.333333333333 23.500000000000
6 29 39.000000000000 40.666666666667
4 8 20.500000000000 20.666666666667
5 16 ...

result:

ok 400 numbers

Test #46:

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

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.000000000000 22.500000000000
18 24 7.000000000000 7.000000000000
4 13 8.000000000000 8.500000000000
4 24 18.000000000000 31.000000000000
7 17 1.000000000000 2.000000000000
25 10 11.000000000000 18.000000000000
6 22 9.000000000000 9.000000000000
24 22 16.000000000000 16.500000000000
1 22 8.5...

result:

ok 400 numbers

Test #47:

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

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.000000000000 8.000000000000
10 19 9.000000000000 9.000000000000
4 15 18.000000000000 20.000000000000
24 2 8.000000000000 15.000000000000
7 20 14.000000000000 15.000000000000
2 19 7.000000000000 7.000000000000
9 10 12.000000000000 18.500000000000
25 27 12.000000000000 12.000000000000
20 6 15.00...

result:

ok 400 numbers

Test #48:

score: 0
Accepted
time: 709ms
memory: 5236kb

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.000000000000 3.000000000000
29 14 7.000000000000 10.000000000000
11 27 12.000000000000 12.000000000000
0 24 14.000000000000 18.000000000000
12 28 1.000000000000 2.000000000000
28 25 10.000000000000 11.000000000000
3 29 12.000000000000 13.000000000000
9 18 5.000000000000 7.000000000000
16 9 7....

result:

ok 400 numbers

Test #49:

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

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.000000000000 24.000000000000
7 6 6.000000000000 7.000000000000
12 16 7.000000000000 9.000000000000
22 24 11.000000000000 21.000000000000
3 9 19.000000000000 25.000000000000
15 21 4.000000000000 7.000000000000
17 29 17.000000000000 24.000000000000
20 22 6.000000000000 8.000000000000
22 21 10....

result:

ok 400 numbers

Test #50:

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

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.000000000000 14.666666666667
12 26 18.000000000000 26.000000000000
7 17 15.000000000000 15.000000000000
27 19 9.000000000000 12.666666666667
4 29 6.000000000000 10.000000000000
28 28 0.000000000000 0.000000000000
18 8 8.000000000000 8.666666666667
21 19 10.000000000000 15.000000000000
5 2 11....

result:

ok 400 numbers

Test #51:

score: 0
Accepted
time: 192ms
memory: 5364kb

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.000000000000 20.000000000000
21 1 19.000000000000 23.000000000000
24 10 15.000000000000 16.000000000000
26 26 0.000000000000 0.000000000000
9 24 10.000000000000 17.000000000000
26 17 11.000000000000 16.000000000000
5 16 8.000000000000 9.000000000000
21 21 0.000000000000 0.000000000000
16 25 1...

result:

ok 400 numbers

Test #52:

score: 0
Accepted
time: 257ms
memory: 5076kb

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.000000000000 6893.000000000000
17 12 3141.000000000000 5670.000000000000
28 7 1941.000000000000 3529.000000000000
28 4 4529.000000000000 4948.000000000000
23 29 1860.000000000000 3720.000000000000
17 28 3299.000000000000 5050.500000000000
5 14 3416.000000000000 5269.000000000000
17 7 1877....

result:

ok 400 numbers

Test #53:

score: 0
Accepted
time: 138ms
memory: 5144kb

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.000000000000 1070.000000000000
24 10 1405.000000000000 1882.000000000000
24 15 1467.000000000000 2934.000000000000
11 16 2463.000000000000 2548.000000000000
4 15 1507.000000000000 1893.000000000000
14 4 1062.000000000000 1649.000000000000
19 25 1237.000000000000 1286.000000000000
12 4 823.0...

result:

ok 400 numbers

Test #54:

score: 0
Accepted
time: 111ms
memory: 5264kb

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.000000000000 3140.000000000000
22 25 2444.000000000000 4888.000000000000
22 10 4024.000000000000 7119.000000000000
8 22 1567.000000000000 3134.000000000000
3 17 1904.000000000000 3551.000000000000
18 9 2453.000000000000 4906.000000000000
24 11 1804.000000000000 3608.000000000000
17 7 3052.0...

result:

ok 400 numbers