QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#402246 | #4370. Road Times | 321625 | TL | 1013ms | 2188kb | C++14 | 3.2kb | 2024-04-30 09:54:24 | 2024-04-30 09:54:25 |
Judging History
answer
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
typedef double ld;
const ld eps=1e-8,Eps=1e-8;
namespace simplex
{
const int N=107,M=307;
inline int sgn(ld x){return (-eps<=x&&x<=eps)?0:(x>0?1:-1);}
int n,m;ld a[M][N],b[M][N];int id[N+M],pivcnt=0;
void pivot(int e,int l)
{
++pivcnt;
// printf(" pivot %d %d\n",e,l);
std::swap(id[n+l],id[e]);
ld kk=-a[l][e];a[l][e]=-1;
for(int j=0;j<=n;++j)a[l][j]/=kk;
for(int i=0;i<=m;++i)if(i!=l&&sgn(a[i][e]))
{
ld coef=a[i][e];a[i][e]=0;
for(int k=0;k<=n;++k)a[i][k]+=coef*a[l][k];
}
}
ld simplex(int _n,int _m)
{
// puts("simplex");
n=_n;m=_m;memcpy(a+1,b+1,m*sizeof*b);
for(int i=1;i<=n+m;++i)id[i]=i;
while(1)
{
int e=0,l=0;
for(int i=1;i<=m;++i)if(sgn(a[i][0])<0&&(!l||a[i][0]<a[l][0]))l=i;
if(!l)break;for(int i=1;i<=n;++i)if(sgn(a[l][i])>0&&id[i]>id[e])e=i;
// if(!e)puts("invalid"),exit(0);
pivot(e,l);
}
// puts("simplexa");
while(1)
{
int e=0,l=0;
for(int i=1;i<=n;++i)if(sgn(a[0][i])>0&&(!e||a[0][e]<a[0][i]))e=i;
if(!e)return **a;
for(int i=1;i<=m;++i)
if(sgn(a[i][e])<0)
{
if(!l){l=i;continue;}
ld crs=a[l][0]*a[i][e]-a[i][0]*a[l][e];
if(sgn(crs)<0||(!sgn(crs)&&id[i]>id[l]))l=i;
}
// if(!l)puts("unbounded"),exit(0);
pivot(e,l);
}
exit(0);
}
}
const int N=37,M=107;
struct pii{int v,w;};bool vis[N];int d[N][N];
bool operator<(pii x,pii y){return x.w>y.w;}
void dijkstra(int s,int n,int*dis,int*pre)
{
memset(dis,0x3f,N<<2);memset(vis,0,N);
dis[s]=pre[s]=0;//printf("s=%d\n",s);
while(1)
{
int p=0;for(int i=1;i<=n;++i)if(!vis[i]&&(!p||dis[i]<dis[p]))p=i;
if(!p)return;vis[p]=1;for(int j=1;j<=n;++j)if(dis[j]>dis[p]+d[p][j])dis[j]=dis[p]+d[p][j],pre[j]=p;//,printf("pr[%d]=%d\n",j,pre[j]);
}
}
int id[N][N],pre[N][N],dis[N][N];
int ds[M];
int main()
{
// freopen("39-random20.in","r",stdin);
// freopen("38-random19.in","r",stdin);
int n,m=0;scanf("%d",&n);
for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)
{
scanf("%d",d[i]+j);
if(i!=j&&d[i][j]!=-1)ds[id[i][j]=++m]=d[i][j];
else if(d[i][j]==-1)d[i][j]=0x3f3f3f3f;
}
for(int i=1;i<=n;++i)dijkstra(i,n,dis[i],pre[i]);
for(int i=1;i<=m;++i)
{
simplex::b[i][0]=ds[i];
simplex::b[i][i]=-1;
}
int ma,mb;scanf("%d",&ma);
for(int i=1;i<=ma;++i)
{
int s,t,d;scanf("%d%d%d",&s,&t,&d);
++s;++t;d-=dis[s][t];
simplex::b[m+i+i-1][0]=d+Eps;
simplex::b[m+i+i][0]=-d+Eps;
for(int j=t;j!=s;j=pre[s][j])
{
int p=pre[s][j],ii=id[p][j];
// printf("p=%d ii=%d\n",p,ii);
simplex::b[m+i+i-1][ii]=-1;
simplex::b[m+i+i][ii]=1;
}
}
scanf("%d",&mb);
for(int i=1;i<=mb;++i)
{
int s,t;scanf("%d%d",&s,&t);++s;++t;
for(int j=0;j<=m;++j)simplex::a[0][j]=0;
for(int j=t;j!=s;j=pre[s][j])
{
int p=pre[s][j],ii=id[p][j];
simplex::a[0][ii]=-1;
}
ld mn=-simplex::simplex(m,m+ma*2)+dis[s][t];
for(int j=0;j<=m;++j)simplex::a[0][j]=0;
for(int j=t;j!=s;j=pre[s][j])
{
int p=pre[s][j],ii=id[p][j];
simplex::a[0][ii]=1;
}
ld mx=simplex::simplex(m,m+ma*2)+dis[s][t];
printf("%d %d %.8lf %.8lf\n",s-1,t-1,mn,mx);
}
// printf("pivcnt=%d mb=%d\n",simplex::pivcnt,mb*2);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 1648kb
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.00000000 80.00000001 1 2 40.00000000 70.00000001 1 0 55.00000000 110.00000000
result:
ok 12 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 1616kb
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.00000000 50.00000001 1 2 40.00000000 40.00000001 1 0 55.00000000 110.00000000
result:
ok 12 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 1608kb
input:
3 0 50 -1 55 0 40 -1 40 0 1 0 2 180 3 0 1 1 2 1 0
output:
0 1 99.99999999 100.00000000 1 2 79.99999999 80.00000000 1 0 55.00000000 110.00000000
result:
ok 12 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 1660kb
input:
6 0 960 -1 -1 -1 -1 -1 0 -1 -1 1000 -1 -1 1000 0 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 1000 0 970 -1 -1 -1 -1 -1 0 3 0 3 5900 2 3 5800 2 5 5700 6 0 1 2 1 1 4 4 3 4 5 0 5
output:
0 1 1899.99999999 1920.00000000 2 1 1799.99999999 1820.00000002 1 4 1979.99999999 2000.00000000 4 3 1979.99999999 2000.00000000 4 5 1879.99999997 1900.00000002 0 5 5799.99999997 5800.00000003
result:
ok 24 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 1704kb
input:
6 0 960 -1 -1 -1 -1 -1 0 -1 -1 1000 -1 -1 1000 0 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 1000 0 940 -1 -1 -1 -1 -1 0 3 0 3 5900 2 3 5800 2 5 5700 6 0 1 2 1 1 4 4 3 4 5 0 5
output:
0 1 1919.99999997 1920.00000000 2 1 1819.99999999 1820.00000002 1 4 1999.99999997 2000.00000000 4 3 1979.99999999 1980.00000002 4 5 1879.99999997 1880.00000000 0 5 5799.99999997 5800.00000000
result:
ok 24 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 1628kb
input:
6 0 950 -1 -1 -1 -1 -1 0 -1 -1 1000 -1 -1 1000 0 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 1000 0 970 -1 -1 -1 -1 -1 0 3 0 3 5900 2 3 5800 2 5 5700 6 0 1 2 1 1 4 4 3 4 5 0 5
output:
0 1 1899.99999999 1900.00000000 2 1 1799.99999999 1800.00000002 1 4 1999.99999999 2000.00000000 4 3 1999.99999999 2000.00000000 4 5 1899.99999997 1900.00000002 0 5 5799.99999997 5800.00000002
result:
ok 24 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 1648kb
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.00000000 0.00000000 0 1 215.99999995 246.00000000 0 2 449.99999995 714.00000000 0 3 1083.99999997 1114.00000002 0 4 1539.99999997 1570.00000002 0 5 2673.99999997 2704.00000002 0 6 3407.99999996 3438.00000001 0 7 4297.99999996 4358.00000006 0 8 5198.99999996 5542.00000003 0 9 5753.99999996 6097...
result:
ok 400 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 1656kb
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.00000000 0.00000000 0 1 215.99999995 246.00000000 0 2 579.99999995 640.00000007 0 3 1083.99999997 1114.00000002 0 4 1539.99999997 1570.00000002 0 5 2673.99999997 2704.00000002 0 6 3407.99999996 3438.00000001 0 7 4297.99999996 4358.00000006 0 8 5198.99999996 5542.00000003 0 9 5753.99999996 6097...
result:
ok 400 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 1716kb
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.00000000 0.00000000 0 1 244.99999996 246.00000000 0 2 608.99999996 640.00000007 0 3 1083.99999997 1114.00000002 0 4 1568.99999998 1570.00000002 0 5 2702.99999998 2704.00000002 0 6 3436.99999997 3438.00000001 0 7 4326.99999997 4358.00000006 0 8 5227.99999997 5541.00000001 0 9 5782.99999997 6097...
result:
ok 400 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 1632kb
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.49999999 10.50000001 1 2 10.49999999 10.50000001 2 0 10.49999999 10.50000001
result:
ok 12 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 1660kb
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.14285712 10.14285716 1 2 10.14285712 10.14285716 2 3 10.14285712 10.14285716 3 4 10.14285712 10.14285716 4 5 10.14285712 10.14285716 5 6 10.14285712 10.14285716 6 7 10.14285712 10.14285716 7 0 10.14285712 10.14285716
result:
ok 32 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 1700kb
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.00000000 11.00000001 1 2 10.00000000 10.33333336 2 3 10.00000000 10.33333336 3 4 10.00000000 10.33333336 4 5 10.00000000 11.00000001 5 6 10.00000000 10.33333336 6 0 10.00000000 10.33333336
result:
ok 28 numbers
Test #13:
score: 0
Accepted
time: 8ms
memory: 1812kb
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.17241377 793.17241381 10 16 726.17241377 726.17241381 16 29 367.17241377 367.17241381 29 15 812.17241377 812.17241381 15 24 959.17241377 959.17241381 24 2 826.17241377 826.17241381 2 7 750.17241377 750.17241381 7 18 865.17241377 865.17241381 18 13 492.17241377 492.17241381 13 12 865.1724137...
result:
ok 400 numbers
Test #14:
score: 0
Accepted
time: 7ms
memory: 1792kb
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.00000000 793.17857145 10 16 726.00000000 726.17857145 16 29 367.00000000 367.17857145 29 15 812.00000000 812.17857145 15 24 959.00000000 959.17857145 24 2 826.00000000 826.17857145 2 7 750.00000000 750.17857145 7 18 865.00000000 865.17857145 18 13 492.00000000 492.17857145 13 12 865.0000000...
result:
ok 400 numbers
Test #15:
score: 0
Accepted
time: 1ms
memory: 1948kb
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.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000 0.00000000 0 0 0.00000000...
result:
ok 400 numbers
Test #16:
score: 0
Accepted
time: 1ms
memory: 1976kb
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.00000000 0.00000000 1 1 0.00000000 0.00000000 2 2 0.00000000 0.00000000 3 3 0.00000000 0.00000000 4 4 0.00000000 0.00000000 5 5 0.00000000 0.00000000 6 6 0.00000000 0.00000000 7 7 0.00000000 0.00000000 8 8 0.00000000 0.00000000 9 9 0.00000000 0.00000000 10 10 0.00000000 0.00000000 11 11 0.0000...
result:
ok 400 numbers
Test #17:
score: 0
Accepted
time: 2ms
memory: 1736kb
input:
30 0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1000 0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1000 0 1000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1000 0 1000 -1...
output:
0 29 57999.99999999 58000.00000000 6 11 9999.99999999 10000.00000000 7 16 17999.99999999 18000.00000000 26 6 20000.00000000 40000.00000000 3 12 17999.99999999 18000.00000000 6 25 37999.99999999 38000.00000000 17 0 17000.00000000 34000.00000000 25 27 3999.99999999 4000.00000000 22 2 20000.00000000 40...
result:
ok 400 numbers
Test #18:
score: 0
Accepted
time: 1ms
memory: 1760kb
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.00000000 29000.00000001 6 11 5000.00000000 5000.00000001 7 16 9000.00000000 9000.00000001 26 6 20000.00000000 40000.00000000 3 12 9000.00000000 9000.00000001 6 25 19000.00000000 19000.00000001 17 0 17000.00000000 34000.00000000 25 27 2000.00000000 2000.00000001 22 2 20000.00000000 40000.0...
result:
ok 400 numbers
Test #19:
score: 0
Accepted
time: 2ms
memory: 1788kb
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.00000000 29000.00000001 6 11 5000.00000000 5000.00000001 7 16 9000.00000000 9000.00000001 26 6 39999.99999999 40000.00000000 3 12 9000.00000000 9000.00000001 6 25 19000.00000000 19000.00000001 17 0 33999.99999999 34000.00000000 25 27 2000.00000000 2000.00000001 22 2 39999.99999999 40000.0...
result:
ok 400 numbers
Test #20:
score: 0
Accepted
time: 2ms
memory: 1788kb
input:
30 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 298 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 342 -1 -1 -1 -1 -1 -1 -1 -1 533 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 236 -1 -1 -1 -1 -1 -1 477 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1...
output:
8 29 1291.99999998 1310.00000002 14 4 1362.99999998 2642.00000000 14 7 1015.99999998 1948.00000000 21 28 236.00000000 472.00000000 0 20 2017.99999999 3428.00000001 2 1 5564.99999998 5896.00000004 9 26 5768.99999998 6091.00000001 4 20 1551.00000000 3102.00000000 10 6 498.00000000 996.00000000 24 19 2...
result:
ok 400 numbers
Test #21:
score: 0
Accepted
time: 4ms
memory: 1864kb
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.00000000 5.00000003 13 26 7.00000000 8.00000002 7 8 10.99999999 16.00000004 26 4 8.99999998 12.00000004 8 27 7.99999999 10.00000001 25 11 3.00000000 5.00000001 5 17 5.00000000 5.00000002 27 1 6.00000000 7.00000001 3 5 6.00000000 6.00000002 6 16 8.99999998 9.00000002 7 9 10.99999999 13.000000...
result:
ok 400 numbers
Test #22:
score: 0
Accepted
time: 22ms
memory: 1816kb
input:
30 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 1...
output:
7 29 27.99999985 31.00000001 0 16 55.99999998 57.00000007 21 8 16.49999991 19.00000001 5 11 30.99999996 33.00000008 17 1 57.99999997 59.00000013 19 16 54.99999998 55.00000008 8 28 45.99999999 46.00000001 10 14 7.99999996 14.00000000 16 24 66.99999999 67.00000001 29 14 10.99999996 18.00000014 24 0 41...
result:
ok 400 numbers
Test #23:
score: 0
Accepted
time: 24ms
memory: 1908kb
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.99999987 491.00000013 15 10 935.99999989 1226.00000011 8 28 599.99999995 600.00000005 16 5 700.99999997 701.00000003 11 2 1582.99999987 1880.00000013 17 21 799.99999991 800.00000009 18 4 1420.99999991 1847.00000009 27 7 647.99999994 745.00000006 14 16 2941.99999999 2942.00000001 17 13 2254....
result:
ok 400 numbers
Test #24:
score: 0
Accepted
time: 49ms
memory: 1972kb
input:
30 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 884 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 171 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 861 -1 -...
output:
2 27 4032.99999995 4033.00000005 17 16 6951.99999994 7034.00000004 2 20 1800.99999996 1801.00000004 5 19 2701.99999990 2702.00000010 20 23 5325.99999995 5326.00000005 11 0 5381.99999996 5382.00000004 9 22 5816.99999995 5974.00000004 8 9 7183.99999991 7314.00000009 26 16 7846.99999995 8792.00000005 2...
result:
ok 400 numbers
Test #25:
score: 0
Accepted
time: 293ms
memory: 2096kb
input:
30 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 1...
output:
24 3 50.99999996 51.00000003 10 4 54.99999999 55.00000001 24 3 50.99999996 51.00000003 19 21 68.99999996 69.00000003 6 27 10.99999999 11.00000001 6 22 44.99999998 45.00000005 7 4 67.99999999 68.00000001 1 4 49.99999999 50.00000003 20 15 48.99999994 49.00000006 22 9 60.99999997 61.00000008 7 8 75.999...
result:
ok 400 numbers
Test #26:
score: 0
Accepted
time: 320ms
memory: 2128kb
input:
30 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 130 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 523 -1 -1 72 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 513 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 2...
output:
5 4 3295.99999998 3296.00000002 6 17 527.99999994 528.00000008 4 15 3950.99999995 3951.00000005 1 10 1499.99999995 1500.00000005 15 25 3212.99999996 3213.00000005 1 16 82.99999994 83.00000005 19 14 5246.99999996 5247.00000004 28 22 3126.99999996 3127.00000005 25 26 1463.99999991 1464.00000008 27 14 ...
result:
ok 400 numbers
Test #27:
score: 0
Accepted
time: 245ms
memory: 2060kb
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.99999997 6819.00000004 6 5 7002.99999995 7003.00000003 27 0 5366.99999997 5367.00000003 2 16 1306.99999996 1307.00000004 3 28 1964.99999997 1965.00000003 17 10 1441.99999999 1442.00000001 7 28 4091.99999997 4092.00000003 20 12 3445.99999993 3446.00000007 20 11 2953.99999992 2954.00000005 ...
result:
ok 400 numbers
Test #28:
score: 0
Accepted
time: 2ms
memory: 1808kb
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.00000000 4506.00000000 12 23 802.00000000 1091.00000001 17 28 2803.99999999 3609.00000001 22 7 595.00000000 1190.00000000 27 10 1225.00000000 1658.00000002 7 29 861.00000000 1722.00000000 5 0 875.00000000 1687.00000001 16 26 1676.00000000 3126.00000001 20 28 591.00000000 1182.00000000 0 21...
result:
ok 400 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 1820kb
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.00000000 1974.00000001 21 29 932.99999999 1805.00000001 21 20 434.00000000 868.00000000 22 28 1914.99999998 3144.00000001 11 23 877.00000000 1754.00000000 25 13 1032.99999999 1110.00000001 11 8 405.00000000 810.00000000 23 19 968.00000000 1936.00000000 24 26 100.00000000 193.00000001 1 6 9...
result:
ok 400 numbers
Test #30:
score: 0
Accepted
time: 5ms
memory: 1888kb
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.00000000 0.00000000 9 16 25.00000000 47.00000001 25 5 526.00000000 1037.00000001 8 24 493.99999999 586.00000001 10 23 934.99999995 1405.00000003 13 20 410.99999999 411.00000001 7 11 792.00000000 1472.00000006 6 26 780.99999995 1233.00000003 29 7 355.99999999 672.00000000 28 12 353.00000000 7...
result:
ok 400 numbers
Test #31:
score: 0
Accepted
time: 10ms
memory: 1900kb
input:
30 0 -1 -1 -1 3 -1 2 -1 -1 -1 6 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 5 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 5 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 8 -1 -1 -1 1 2 -1 0 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 -...
output:
8 15 18.99999997 19.00000002 7 18 16.99999995 21.00000003 10 15 14.99999999 16.00000004 10 7 11.00000000 22.00000000 25 13 17.99999999 20.00000001 29 15 3.00000000 4.00000003 11 5 7.99999999 8.00000005 28 12 23.99999991 25.00000008 5 19 21.99999998 31.00000001 0 24 6.99999994 10.00000001 17 20 14.99...
result:
ok 400 numbers
Test #32:
score: 0
Accepted
time: 35ms
memory: 2028kb
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.00000000 1368.00000000 12 25 2583.99999999 2584.00000001 17 23 1272.99999995 1307.00000005 13 2 912.99999998 947.00000002 8 16 499.99999996 572.00000004 25 19 2298.99999985 2299.00000015 14 4 1417.99999998 1418.00000002 23 17 3154.99999999 3155.00000001 4 9 737.99999997 738.00000003 29 25 2...
result:
ok 400 numbers
Test #33:
score: 0
Accepted
time: 310ms
memory: 2100kb
input:
30 0 -1 196 -1 -1 -1 229 -1 -1 -1 -1 -1 -1 -1 -1 457 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 499 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 -1 534 -1 -1 808 -1 788 -1 324 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 475 -1 -1 -1 -1 -1 384 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 58 -1 0 -1 -1 -1 -...
output:
3 14 1087.99999996 1088.00000006 12 28 1071.99999993 1272.00000006 15 24 1975.99999999 1976.00000001 4 12 1024.99999991 1301.00000009 18 3 2081.99999997 2082.00000003 5 20 854.99999999 1236.00000000 2 6 993.99999994 1409.00000005 27 19 2923.99999994 2924.00000006 21 13 276.99999989 277.00000011 23 7...
result:
ok 400 numbers
Test #34:
score: 0
Accepted
time: 11ms
memory: 2188kb
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.00000000 7.00000001 18 19 2.99999998 3.00000002 26 26 0.00000000 0.00000000 18 17 4.99999999 5.00000001 2 19 5.99999997 6.00000003 10 2 3.99999998 4.00000001 16 21 2.99999998 3.00000001 23 28 1.00000000 2.00000000 24 14 4.00000000 4.00000001 4 25 4.99999999 5.00000001 20 29 2.00000000 4.00000...
result:
ok 400 numbers
Test #35:
score: 0
Accepted
time: 68ms
memory: 2168kb
input:
30 0 -1 -1 -1 -1 -1 -1 -1 -1 1 2 -1 -1 2 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 2 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
output:
5 28 5.99999999 7.00000001 5 29 4.00000000 7.00000002 23 3 7.99999998 11.00000003 11 10 3.99999997 4.00000002 27 4 3.99999997 4.00000006 5 0 4.99999999 5.00000001 21 21 0.00000000 0.00000000 29 27 6.00000000 6.00000001 7 17 5.99999997 6.00000001 21 21 0.00000000 0.00000000 0 5 4.99999998 5.00000001 ...
result:
ok 400 numbers
Test #36:
score: 0
Accepted
time: 28ms
memory: 2128kb
input:
30 0 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 3 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 3 -1 -1 -1 -1 -1 5 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 5 -1 5 -1 -1 -1 -1...
output:
27 11 10.99999992 11.00000003 25 6 3.99999999 4.00000002 6 12 12.99999997 13.00000004 20 23 8.99999997 9.00000001 4 12 13.99999995 14.00000004 23 23 0.00000000 0.00000000 15 9 2.99999998 3.00000002 0 28 5.99999997 6.00000001 7 29 3.00000000 3.00000002 8 16 12.99999992 13.00000002 25 0 7.99999996 8.0...
result:
ok 400 numbers
Test #37:
score: 0
Accepted
time: 149ms
memory: 2188kb
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.99999999 15.00000004 22 2 7.99999999 8.00000003 20 4 11.99999997 12.00000004 9 27 3.99999998 4.00000003 21 6 9.99999999 11.00000001 13 17 6.99999995 7.00000003 28 9 2.99999998 3.00000001 16 13 16.00000000 16.00000004 9 4 7.99999999 8.00000001 4 24 9.99999997 12.00000005 5 28 10.99999997 11....
result:
ok 400 numbers
Test #38:
score: 0
Accepted
time: 338ms
memory: 2140kb
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.00000000 18.00000009 3 4 49.99999999 50.00000001 28 8 39.99999999 47.00000004 20 23 34.99999995 50.00000003 0 9 27.00000000 47.00000001 10 20 46.99999999 74.00000001 26 3 8.99999998 9.00000007 21 2 28.99999997 29.00000002 1 18 36.99999996 37.00000002 15 26 48.99999994 49.00000003 21 27 35.9...
result:
ok 400 numbers
Test #39:
score: 0
Accepted
time: 1013ms
memory: 2112kb
input:
30 0 -1 -1 -1 23 58 -1 17 -1 -1 51 -1 21 65 -1 -1 -1 28 -1 45 -1 -1 -1 -1 -1 18 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 35 -1 8 -1 -1 48 -1 -1 -1 -1 -1 -1 -1 15 33 0 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 35 46 -1 -1 -1 -1 9 -1 -1 -1 -1 14 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 59 67 -1 5...
output:
9 20 114.99999993 115.00000007 24 10 110.99999982 111.00000018 23 12 117.99999994 118.00000003 21 7 201.99999997 202.00000003 21 19 93.99999995 94.00000004 17 11 82.99999996 83.00000007 14 4 147.99999999 148.00000001 2 8 94.99999996 95.00000004 14 2 90.99999996 91.00000004 7 7 0.00000000 0.00000000 ...
result:
ok 400 numbers
Test #40:
score: -100
Time Limit Exceeded
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...