QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#355681#4370. Road TimesCrysflyWA 173ms6712kbC++174.5kb2024-03-17 02:02:172024-03-17 02:02:18

Judging History

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

  • [2024-03-17 02:02:18]
  • 评测
  • 测评结果:WA
  • 用时:173ms
  • 内存:6712kb
  • [2024-03-17 02:02:17]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

const ll P=2305843009213693951;
 
inline ll mul(ll x,ll y){
//	return (__int128)x*y%P;
	ll s=x*y-(ll)((long double)x*y/P)*P;
	if(s<0)return s+P;
	return (s<P?s:s-P);
}
//ll qpow(ll a,ll b){
//	ll c=1;
//	for(;b;b>>=1,a=mul(a,a))if(b&1)c=mul(c,a);
//	return c;
//}
 
#define mod P
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=mul(x,o.x),*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,int b){return a.x==b;}
	friend bool operator !=(modint a,int b){return a.x!=b;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
 
#define maxn 300005
#define inf 0x3f3f3f3f

int n,id[35][35],f[35][35],g[35][35],cnt;

vector<vector<double>>a;
vector<double>aa;

namespace S{

#define N 2005
typedef double db;
int n,m,id[N];
db a[N][N],res[N],eps=1e-10;
inline int sgn(db x){return x>=-eps&&x<=eps?0:(x<0?-1:1);}

void pivot(int x,int y){
	swap(id[n+x],id[y]);
	db d=-a[x][y];
	For(i,0,n)a[x][i]/=d;
	a[x][y]=-1.0/d;
	For(i,0,m)
		if(i!=x&&sgn(a[i][y])){
			d=a[i][y]; a[i][y]=0;
			For(j,0,n) a[i][j]+=a[x][j]*d;
		}
}

double simplex(vector<vector<double>>aa)
{
	m=aa.size()-1,n=aa[0].size()-1;
	For(i,0,m)For(j,0,n)a[i][j]=aa[i][j];
	For(i,1,m)For(j,1,n)a[i][j]=-a[i][j];
//	cout<<"m,n "<<m<<" "<<n<<"\n";
//	For(i,0,m)For(j,0,n)cout<<a[i][j]<<" \n"[j==n];
	For(i,1,n+m)id[i]=i;
	while(1)
	{
		int u=1,v=0;
		For(i,1,m) if(a[i][0]<a[u][0])u=i;
		if(sgn(a[u][0])>=0)break;
		For(j,1,n) if(sgn(a[u][j])>0 && (!v||id[j]>id[v])) v=j;
		if(!v)puts("Infeasible"),exit(0);
		pivot(u,v);
	}
	while(1)
	{
		int u=0,v=1;
		db mn=1e9;
		For(j,1,n) if(a[0][j]>a[0][v])v=j;
		if(sgn(a[0][v])<=0)break;
		For(i,1,m)
			if(sgn(a[i][v])<0){
				db t=-a[i][0]/a[i][v];
				if(sgn(t-mn)<0 || (sgn(t-mn)==0 && (!u||id[i]>id[u]))) mn=t,u=i;
			}
		if(!u)puts("Unbounded"),exit(0); 
		pivot(u,v);
	}
	return a[0][0];
}

}

vi p;
void path(int u,int v){
	p.clear();
	int dis=f[u][v];
	while(u!=v){
		For(i,1,n)
			if(id[u][i] && g[u][i]+f[i][v]==dis){
				p.pb(id[u][i]);
				dis-=g[u][i];
				u=i; break;
			}
	}
}

signed main()
{
	n=read();
	For(i,1,n)For(j,1,n){
		f[i][j]=read();
		if(f[i][j]==-1)f[i][j]=inf;
		else if(f[i][j])id[i][j]=++cnt;
		g[i][j]=f[i][j];
	}
	For(k,1,n)For(i,1,n)For(j,1,n)f[i][j]=min(f[i][j],f[i][k]+f[k][j]);
	For(i,1,n)For(j,1,n)if(id[i][j]){
		vector<double>t(cnt+1,0);
		t[0]=g[i][j]*2,t[id[i][j]]=1;
		a.pb(t);
		t[0]=-g[i][j],t[id[i][j]]=-1;
		a.pb(t);
	}
	int m=read();
	For(_,1,m){
		int u=read(),v=read(),w=read();
		++u,++v;
		path(u,v);
		for(int i:{1,-1}){
			vector<double>t(cnt+1,0);
			for(auto x:p) t[x]=i;
			t[0]=w*i;
			a.pb(t);
		}
	}
	m=read();
	For(_,1,m){
		int u=read(),v=read();
		++u,++v;
		path(u,v);
		cout<<u-1<<" "<<v-1;
		for(int i:{-1,1}){
			vector<double>t(cnt+1,0);
			for(auto x:p) t[x]=i;
			auto aa=a;
			aa.insert(aa.begin(),t);
			printf(" %.10lf",S::simplex(aa)*i);
		}
		cout<<"\n";
	}
	return 0;
}
/*

*/

詳細信息

Test #1:

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

input:

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

output:

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

result:

ok 12 numbers

Test #2:

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

input:

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

output:

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

result:

ok 12 numbers

Test #3:

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

input:

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

output:

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

result:

ok 12 numbers

Test #4:

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

input:

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

output:

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

result:

ok 24 numbers

Test #5:

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

input:

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

output:

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

result:

ok 24 numbers

Test #6:

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

input:

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

output:

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

result:

ok 24 numbers

Test #7:

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

input:

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

output:

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

result:

ok 400 numbers

Test #8:

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

input:

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

output:

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

result:

ok 400 numbers

Test #9:

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

input:

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

output:

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

result:

ok 400 numbers

Test #10:

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

input:

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

output:

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

result:

ok 12 numbers

Test #11:

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

input:

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

output:

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

result:

ok 32 numbers

Test #12:

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

input:

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

output:

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

result:

ok 28 numbers

Test #13:

score: 0
Accepted
time: 10ms
memory: 4552kb

input:

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

output:

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

result:

ok 400 numbers

Test #14:

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

input:

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

output:

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

result:

ok 400 numbers

Test #15:

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

input:

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

output:

0 0 -0.0000000000 0.0000000000
0 0 -0.0000000000 0.0000000000
0 0 -0.0000000000 0.0000000000
0 0 -0.0000000000 0.0000000000
0 0 -0.0000000000 0.0000000000
0 0 -0.0000000000 0.0000000000
0 0 -0.0000000000 0.0000000000
0 0 -0.0000000000 0.0000000000
0 0 -0.0000000000 0.0000000000
0 0 -0.0000000000 0.0...

result:

ok 400 numbers

Test #16:

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

input:

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

output:

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

result:

ok 400 numbers

Test #17:

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

input:

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

output:

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

result:

ok 400 numbers

Test #18:

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

input:

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

output:

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

result:

ok 400 numbers

Test #19:

score: 0
Accepted
time: 9ms
memory: 4488kb

input:

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

output:

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

result:

ok 400 numbers

Test #20:

score: 0
Accepted
time: 11ms
memory: 4928kb

input:

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

output:

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

result:

ok 400 numbers

Test #21:

score: 0
Accepted
time: 11ms
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 3 -1
-1 -1 0 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 2 -...

output:

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

result:

ok 400 numbers

Test #22:

score: 0
Accepted
time: 19ms
memory: 4816kb

input:

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

output:

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

result:

ok 400 numbers

Test #23:

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

input:

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

output:

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

result:

ok 400 numbers

Test #24:

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

input:

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

output:

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

result:

ok 400 numbers

Test #25:

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

input:

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

output:

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

result:

ok 400 numbers

Test #26:

score: 0
Accepted
time: 157ms
memory: 5828kb

input:

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

output:

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

result:

ok 400 numbers

Test #27:

score: 0
Accepted
time: 144ms
memory: 5480kb

input:

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

output:

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

result:

ok 400 numbers

Test #28:

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

input:

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

output:

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

result:

ok 400 numbers

Test #29:

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

input:

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

output:

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

result:

ok 400 numbers

Test #30:

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

input:

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

output:

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

result:

ok 400 numbers

Test #31:

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

input:

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

output:

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

result:

ok 400 numbers

Test #32:

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

input:

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

output:

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

result:

ok 400 numbers

Test #33:

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

input:

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

output:

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

result:

ok 400 numbers

Test #34:

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

input:

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

output:

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

result:

ok 400 numbers

Test #35:

score: 0
Accepted
time: 117ms
memory: 6524kb

input:

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

output:

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

result:

ok 400 numbers

Test #36:

score: 0
Accepted
time: 83ms
memory: 6696kb

input:

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

output:

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

result:

ok 400 numbers

Test #37:

score: -100
Wrong Answer
time: 11ms
memory: 6712kb

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 24Infeasible

result:

wrong output format Expected double, but "24Infeasible" found