QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#816699#9532. 长野原龙势流星群Naganohara_Yoimiya10 27ms227964kbC++203.6kb2024-12-16 16:50:142024-12-16 16:50:15

Judging History

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

  • [2024-12-16 16:50:15]
  • 评测
  • 测评结果:10
  • 用时:27ms
  • 内存:227964kb
  • [2024-12-16 16:50:14]
  • 提交

answer

#include<bits/stdc++.h>

#define ll long long
#define mk make_pair
#define fi first
#define se second
#define ull unsigned long long

using namespace std;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;(c<'0'||c>'9');c=getchar()){if(c=='-')f=-1;}
	for(;(c>='0'&&c<='9');c=getchar())x=x*10+(c&15);
	return x*f;
}

const int mod=998244353;
int ksm(int x,ll y,int p=mod){
	int ans=1;y%=(p-1);
	for(int i=y;i;i>>=1,x=1ll*x*x%p)if(i&1)ans=1ll*ans*x%p;
	return ans%p;
}
int inv(int x,int p=mod){return ksm(x,p-2,p)%p;}
mt19937_64 rnd(20070819);
int randint(int l,int r){return rnd()%(r-l+1)+l;}
void add(int &x,int v){x+=v;if(x>=mod)x-=mod;}
void Mod(int &x){if(x>=mod)x-=mod;}
int cmod(int x){if(x>=mod)x-=mod;return x;}

template<typename T>void cmax(T &x,T v){x=max(x,v);}
template<typename T>void cmin(T &x,T v){x=min(x,v);}

const int N=2e5+5;
vector<int>G[N];
int n;
ll a[N];

struct Info{
	int cnt;ll sum;
	Info(int C=0,ll S=0):cnt(C),sum(S){}
	bool operator<(const Info &rhs)const{
		return sum*rhs.cnt>rhs.sum*cnt;
	}
};
Info operator+(Info A,Info B){return Info(A.cnt+B.cnt,A.sum+B.sum);}
ll Cross(Info A,Info B){return A.cnt*B.sum-A.sum*B.cnt;}

struct Node{int ls,rs,siz;ull rk;Info val,sum;};

Node d[N*20];int tot=0,b[N*20],cnt;
#define ls(p) (d[p].ls)
#define rs(p) (d[p].rs)
int build(Info v){
	int p=cnt>0?b[cnt--]:++tot;d[p].ls=d[p].rs=0;
	d[p].siz=1,d[p].rk=rnd();
	d[p].val=d[p].sum=v;
	return p;
}
void del(int p){d[p].val=d[p].sum=Info(0,0),d[p].siz=d[p].rk=d[p].ls=d[p].rs=0;b[++cnt]=p;}
void pushup(int p){
	d[p].siz=d[ls(p)].siz+d[rs(p)].siz+1;
	d[p].sum=d[ls(p)].sum+d[rs(p)].sum+d[p].val;
}
void split(int p,int k,int &x,int &y){
	if(!p){x=y=0;return ;}
	if(k<=d[ls(p)].siz)y=p,split(ls(p),k,x,ls(y)),pushup(y);
	else x=p,split(rs(p),k-d[ls(p)].siz-1,rs(x),y),pushup(x);
}
int merge(int p,int q){
	if(!p||!q)return p^q;
	if(d[p].rk<d[q].rk){d[p].rs=merge(rs(p),q);pushup(p);return p;}
	else{d[q].ls=merge(p,ls(q));pushup(q);return q;}
}
int getrk(Info v,int p){
	if(!p)return 0;
	if(d[p].val<v)return d[ls(p)].siz+1+getrk(v,rs(p));
	return getrk(v,ls(p));
}
void ins(Info v,int &p){
	int k=getrk(v,p);
	int A=0,B=0;
	split(p,k,A,B);
	int q=build(v);
	p=merge(A,merge(q,B));
}
void Merge(int &p,int q){
	if(!q)return ;
	ins(d[q].val,p);
	Merge(p,ls(q)),Merge(p,rs(q));
}
void Del(int p){
	if(!p)return ;
	Del(ls(p)),Del(rs(p)),del(p);
}
int getmn(int p){
	if(!p)return 0;
	if(!ls(p))return p;
	return getmn(ls(p));
}
void pop(int &p){
	int A=0,B=0;
	split(p,1,A,B);
	p=B;
}

Info Ans;
void qry(int p,Info pf){
	if(!p)return ;
	Info L=d[ls(p)].sum;
	if(Cross(pf+L,d[p].val)>=0)Ans=pf+L+d[p].val,qry(rs(p),pf+L+d[p].val);
	else qry(ls(p),pf);
}
#undef ls
#undef rs

int root[N],sz[N];
Info ans[N];
void dfs(int u){
	sz[u]=1;
	for(int v:G[u])dfs(v),sz[u]+=sz[v];
	sort(G[u].begin(),G[u].end(),[&](int x,int y){return sz[x]>sz[y];});
	for(int v:G[u]){
		if(!root[u])root[u]=root[v];
		else Merge(root[u],root[v]),Del(root[v]);
	}

	int p=getmn(root[u]);ll c0=1,s0=a[u];
	while(p){
		if(Cross(d[p].val,Info(c0,s0))<=0){
			c0+=d[p].val.cnt,s0+=d[p].val.sum;
			pop(root[u]),p=getmn(root[u]);
		}
		else break;
	}
	ins(Info(c0,s0),root[u]);
	
	p=getmn(root[u]);
	assert(d[root[u]].siz<=2000);
	ans[u]=d[p].val;
}

ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

signed main(void){
	
	n=read();
	for(int i=2;i<=n;i++){int p=read();G[p].emplace_back(i);}
	for(int i=1;i<=n;i++)a[i]=read();

	dfs(1);
	for(int i=1;i<=n;i++){
		auto [x,y]=ans[i];
		ll g=gcd(x,y);x/=g,y/=g;
		double dx=x,dy=y;
		cout<<fixed<<setprecision(6)<<dy/dx<<'\n';
	}

	return 0;
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

2000
1 2 2 4 5 2 3 6 4 2 7 2 8 14 8 12 1 14 4 14 8 18 9 2 7 22 20 22 14 29 28 16 6 21 23 6 21 14 13 9 1 4 18 13 2 39 21 33 18 20 38 27 27 1 49 5 51 3 31 24 10 42 2 44 13 9 35 66 27 60 67 59 29 40 53 2 33 43 26 43 62 16 78 45 14 10 73 69 41 35 25 26 2 70 54 1 54 48 5 36 44 28 90 29 51 51 93 82 95 45 ...

output:

883838885.923077
887174926.000000
881025216.709677
912609654.666667
872318573.500000
831791515.153846
867874850.000000
892392319.166667
836427216.000000
869519853.800000
693335785.375000
925100890.000000
994728511.500000
950304719.000000
808673189.250000
866832100.571429
963096715.000000
919109808.0...

result:

ok 2000 numbers

Test #2:

score: 10
Accepted
time: 15ms
memory: 227024kb

input:

2000
1 1 1 1 1 6 6 6 8 1 7 6 9 4 11 10 17 1 9 20 4 2 7 22 13 21 5 26 19 20 9 8 24 22 32 24 24 8 30 7 22 22 7 14 4 18 30 38 9 45 21 38 53 16 39 6 44 12 10 34 14 17 54 14 65 55 17 21 40 9 27 65 54 53 61 30 3 52 57 49 31 34 16 32 11 85 81 43 36 43 3 45 42 93 83 37 86 77 2 23 41 77 19 18 51 91 68 22 85 ...

output:

794920955.220000
713825019.500000
734115991.800000
800547209.783784
734508347.000000
760946433.375000
750093634.897959
735976830.111111
765501191.941176
747665901.952381
816306482.500000
741938108.111111
790936468.750000
784791287.904762
686615692.833333
784654712.000000
758683709.428571
729910356.2...

result:

ok 2000 numbers

Test #3:

score: 10
Accepted
time: 11ms
memory: 226476kb

input:

2000
1 1 2 3 3 3 3 4 2 8 4 6 2 10 1 8 8 13 1 19 15 18 8 17 20 16 16 21 11 28 14 18 31 4 30 24 17 10 22 26 2 34 14 13 13 37 43 3 3 38 9 4 29 43 29 46 7 55 9 23 23 49 29 12 45 25 67 59 45 24 5 55 52 73 51 28 25 26 49 78 62 10 18 1 35 73 35 16 52 62 5 89 4 49 12 46 55 14 18 68 64 25 21 88 25 19 82 46 4...

output:

755177543.516129
762060513.294118
754126791.262500
777333185.550000
758703127.500000
756576527.222222
764146306.785714
750062914.140000
710728919.812500
770351278.750000
769495170.000000
776873566.571429
763361472.600000
718961316.454545
691159863.285714
743603379.900000
735209305.142857
751245603.7...

result:

ok 2000 numbers

Test #4:

score: 10
Accepted
time: 27ms
memory: 227028kb

input:

2000
1 1 3 4 1 1 4 3 3 2 1 3 11 3 1 7 17 9 7 18 4 5 16 10 16 14 12 6 16 22 28 32 27 4 4 19 36 38 12 31 28 18 30 44 35 43 44 29 10 29 7 18 18 35 23 42 12 24 23 2 42 59 8 24 14 49 16 62 38 46 7 34 41 41 10 20 53 71 18 38 63 54 26 76 39 84 28 36 9 53 26 19 39 34 26 49 86 10 64 34 74 43 19 70 97 35 92 4...

output:

914894038.533333
918141155.833333
911927555.000000
870659540.153846
777969562.235294
778920774.555556
876560725.000000
974455318.000000
858643515.250000
835985850.619048
963419161.250000
868819817.000000
813378295.000000
984875621.000000
762109464.000000
848271420.800000
880900220.666667
831784753.1...

result:

ok 2000 numbers

Test #5:

score: 10
Accepted
time: 12ms
memory: 225888kb

input:

2000
1 2 2 3 2 1 7 8 8 6 9 12 12 3 8 3 9 15 3 19 8 7 4 19 18 23 10 21 10 15 10 22 1 21 19 26 1 38 38 1 18 37 14 27 37 43 30 4 2 2 13 42 13 9 13 38 21 23 58 32 13 62 18 62 15 49 5 61 1 45 29 48 38 34 31 43 45 38 52 54 13 21 78 36 21 45 57 14 25 18 29 45 2 43 8 51 75 79 95 55 29 98 55 93 33 5 93 14 77...

output:

865975765.954023
864960665.600000
853815173.555556
725289681.800000
835914002.750000
751151162.300000
880779494.263158
883843482.916667
866946310.460000
875695250.272727
798984107.400000
869102654.892857
879836598.416667
911092097.000000
850227694.520000
912108140.000000
788766596.000000
908587648.2...

result:

ok 2000 numbers

Test #6:

score: 10
Accepted
time: 3ms
memory: 227672kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

780031265.285714
709196423.634146
852016017.000000
710198590.855072
942523004.000000
795582647.000000
817131607.000000
723247621.675000
711787456.321429
702698215.818182
778948304.750000
825829512.666667
731540545.684211
717838198.725000
755917182.343750
757290967.000000
701845412.000000
765904155.0...

result:

ok 2000 numbers

Test #7:

score: 10
Accepted
time: 4ms
memory: 226908kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

621161049.048780
460347579.946154
624970425.723926
386751620.240310
463913107.317829
565084289.953488
628866372.379845
344826388.200000
389755854.015625
428515994.796875
467520113.531250
517598544.164062
569478380.304688
614133627.304688
633756627.085938
326352451.421875
350161826.796875
371290988.4...

result:

ok 2000 numbers

Test #8:

score: 10
Accepted
time: 8ms
memory: 226716kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

621374004.574879
487030122.875000
624597241.700000
939364019.000000
480110389.248062
578610053.000000
628514468.213836
497600202.000000
398302285.670103
430778150.178862
483844086.023438
534427093.269841
585697877.259259
623651552.673913
634659006.721650
362791676.600000
615710029.000000
399282176.4...

result:

ok 2000 numbers

Test #9:

score: 10
Accepted
time: 12ms
memory: 227884kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

762088830.233333
781353370.172414
714336862.833333
723995695.130435
787379090.464286
708370854.052632
735529969.826087
725933828.318182
721088075.738095
810402666.888889
798070041.714286
761321868.000000
708379177.740741
806707103.000000
682416751.760000
647471750.346154
757813177.937500
726620918.8...

result:

ok 2000 numbers

Test #10:

score: 10
Accepted
time: 11ms
memory: 226404kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

796409562.000000
777105384.250000
719995401.840000
755696351.523810
972657380.000000
705728479.946429
822339463.666667
756514023.714286
858700663.000000
980362468.000000
924539106.000000
708454243.000000
722158127.310345
856914923.000000
691671807.782609
683937541.666667
870081899.000000
834375962.0...

result:

ok 2000 numbers

Test #11:

score: 10
Accepted
time: 12ms
memory: 225936kb

input:

2000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

984618295.615385
902277197.000000
383235589.000000
742640716.000000
613666672.000000
291453150.000000
625937043.000000
958739025.000000
34831727.000000
240997073.000000
334863696.000000
223278814.000000
111864227.000000
669195136.000000
172511184.000000
491717571.000000
830307774.000000
47914339.000...

result:

ok 2000 numbers

Test #12:

score: 10
Accepted
time: 12ms
memory: 227324kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

506787773.313433
507473433.654135
508859284.166667
556160454.250000
620472531.000000
867793536.000000
786222333.000000
511025497.680851
532981265.428571
612986220.000000
767631955.666667
992646284.000000
966889609.000000
550282737.333333
558374546.375000
619616863.857143
698180346.833333
732460680.0...

result:

ok 2000 numbers

Test #13:

score: 10
Accepted
time: 11ms
memory: 227796kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

470231718.696500
470466543.196098
470701431.425425
470936546.634952
471171816.946894
471407223.846115
471642829.774323
471878447.555444
472114168.722390
472349720.805123
472585326.962312
472820288.285571
473055435.262072
473290386.776044
473525045.662638
473759836.661965
473994654.338206
474229587.6...

result:

ok 2000 numbers

Test #14:

score: 10
Accepted
time: 12ms
memory: 227572kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

483979076.413000
484220856.564282
484462747.642142
484704388.627441
484945699.843186
485187059.897744
485428332.702106
759340416.000000
485532302.721386
485773818.607735
485873366.313568
486115034.551533
486356702.876258
486598458.967287
486839953.813192
487081406.148111
487322771.225302
487564178.6...

result:

ok 2000 numbers

Test #15:

score: 10
Accepted
time: 16ms
memory: 226364kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

685495666.500000
869312055.000000
517163136.736842
526888922.166667
654153657.000000
547770219.333333
569562360.333333
819660511.500000
847532860.000000
564798030.600000
855185985.000000
585505461.333333
854052921.500000
868020227.000000
543898108.142857
788190101.000000
579549290.800000
688701084.7...

result:

ok 2000 numbers

Test #16:

score: 10
Accepted
time: 16ms
memory: 227296kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

491106693.508772
494822795.928571
501410786.145455
504759328.592593
512059105.358491
513949461.363636
522550566.900000
915653935.000000
537905061.000000
581374942.571429
920748817.000000
597709195.200000
913259553.000000
611387316.000000
733489540.000000
730809721.000000
512659777.634146
519568685.4...

result:

ok 2000 numbers

Test #17:

score: 10
Accepted
time: 12ms
memory: 227348kb

input:

2000
1 1 3 3 2 5 4 2 1 5 7 1 7 5 11 7 13 15 15 18 12 17 13 19 15 12 25 18 24 30 30 23 19 20 32 36 25 27 30 37 28 33 34 35 31 38 35 45 48 50 48 50 40 45 43 49 53 53 52 54 61 56 53 63 60 58 54 58 68 68 69 68 70 73 62 71 71 77 69 69 71 74 72 76 79 80 81 83 75 86 90 86 91 91 91 85 90 88 99 90 94 91 102 ...

output:

734060776.500000
907170094.000000
884436883.000000
248349393.000000
731751628.857143
122787902.000000
631204225.000000
3817027.000000
52135197.000000
803280314.000000
259513623.000000
590964999.500000
628669677.666667
438379256.000000
824486735.666667
54817085.000000
828818140.000000
698066142.00000...

result:

ok 2000 numbers

Test #18:

score: 10
Accepted
time: 16ms
memory: 225976kb

input:

2000
1 1 1 3 1 5 1 7 6 6 8 3 9 7 14 2 7 7 11 7 13 19 19 12 16 13 18 16 19 23 18 32 24 34 32 31 28 34 26 31 41 28 42 30 33 43 47 38 49 38 49 40 41 49 44 45 54 52 51 53 55 59 52 61 52 61 65 65 60 58 62 68 73 65 71 76 64 71 68 73 67 75 73 75 75 80 81 76 76 87 77 85 93 82 93 84 89 97 88 89 96 102 92 100...

output:

712001072.839286
4201358.500000
713061983.144560
2244053.000000
714122990.614925
5225148.333333
715187323.005997
5869207.000000
716256611.593985
3957454.000000
6429324.000000
7157175.000000
8323923.000000
717329802.247360
7273392.000000
718402495.954683
7607052.000000
24802290.687500
44455955.185185...

result:

ok 2000 numbers

Test #19:

score: 10
Accepted
time: 3ms
memory: 227184kb

input:

2000
1 1 1 2 1 6 2 5 1 2 9 11 1 13 10 12 5 5 13 13 14 17 14 22 13 15 16 16 28 21 31 18 26 21 21 26 34 28 39 31 36 32 34 40 34 40 44 46 46 46 50 47 45 53 42 42 46 46 49 47 60 62 59 61 59 59 66 63 67 60 62 70 68 64 62 70 68 70 79 76 81 75 80 70 80 85 85 85 85 83 80 88 89 92 83 90 93 95 99 93 100 88 89...

output:

697496384.399361
698611495.704000
143289881.000000
1583426.000000
9656032.750000
2424102.000000
2532741.000000
3850673.000000
7472201.000000
518530306.000000
699729704.716346
8643690.333333
700410693.559486
550989099.000000
10028394.000000
102473363.500000
9976541.000000
13294556.000000
9951854.0000...

result:

ok 2000 numbers

Test #20:

score: 10
Accepted
time: 15ms
memory: 226896kb

input:

2000
1 1 1 3 1 4 3 7 5 6 7 3 7 8 10 6 13 4 12 18 16 16 10 15 20 18 15 24 15 19 24 21 32 22 25 25 33 30 37 37 40 29 31 32 40 39 44 38 39 45 50 52 46 45 48 45 46 47 56 48 51 49 63 51 57 63 61 57 58 58 64 61 63 60 61 63 71 77 66 78 77 70 81 70 85 80 83 84 84 77 78 86 84 85 91 82 83 85 92 92 88 92 101 1...

output:

788364530.666667
291116820.000000
705269522.000000
968497131.000000
479210979.500000
984278789.000000
749238791.000000
650055971.263158
330485123.000000
502037324.000000
306298229.000000
306940374.333333
516159818.769231
428612966.000000
666892243.555556
452722178.500000
215785225.000000
750749738.5...

result:

ok 2000 numbers

Test #21:

score: 10
Accepted
time: 7ms
memory: 227964kb

input:

2000
1 1 3 4 1 4 7 3 9 5 1 6 8 5 12 16 6 12 13 15 11 15 13 17 20 21 14 14 21 19 22 18 30 25 28 36 26 24 37 34 40 39 43 44 37 44 44 36 49 38 40 51 48 42 49 47 53 48 51 58 48 62 57 59 65 59 65 59 57 69 63 62 64 70 72 75 64 77 70 68 71 80 78 77 79 78 87 86 86 84 84 89 84 84 88 92 91 85 98 99 101 90 96 ...

output:

652426645.721591
506709211.000000
626941277.666667
640221680.000000
530323185.833333
829464142.000000
531001334.666667
577506393.800000
991902092.000000
1000662.000000
123643298.000000
660010334.000000
658531895.333333
806631985.000000
550446841.600000
834183236.000000
708224770.500000
693380373.000...

result:

ok 2000 numbers

Test #22:

score: 10
Accepted
time: 19ms
memory: 225852kb

input:

2000
1 2 3 4 4 3 7 3 9 7 7 9 12 14 4 7 1 18 7 6 19 11 21 24 23 15 22 3 1 14 9 24 26 14 9 8 1 32 21 13 11 4 3 4 25 24 18 10 9 36 10 18 53 25 6 26 19 26 44 29 34 56 40 63 60 43 50 63 52 64 59 56 62 52 50 72 47 55 67 48 55 54 53 44 57 81 44 64 49 61 44 43 52 78 91 60 48 71 74 78 83 63 72 64 96 59 75 77...

output:

661041438.183333
709912195.857143
738067587.000000
723579217.400000
671235505.000000
661735797.645161
661572310.395833
592983701.000000
616968314.687500
649054462.933333
777022558.000000
455883204.250000
297814380.000000
627502618.000000
547794736.000000
813534857.000000
33670255.000000
648111737.25...

result:

ok 2000 numbers

Test #23:

score: 10
Accepted
time: 24ms
memory: 227456kb

input:

2000
1 2 1 1 3 3 5 3 1 8 3 7 12 2 6 13 6 18 1 4 17 12 5 4 4 8 9 21 24 17 13 26 3 9 23 28 9 38 18 1 29 35 14 43 40 23 46 25 13 30 40 23 7 45 39 39 28 58 24 32 31 56 39 35 21 26 27 48 39 65 52 24 45 39 52 62 66 30 64 45 60 56 67 57 47 56 47 49 70 51 67 47 51 64 66 79 70 80 92 64 73 68 63 61 64 79 107 ...

output:

784494649.520161
728336562.564014
730864296.579861
787670154.591093
53300176.888889
24228432.000000
97778937.736842
37729196.714286
733404194.550523
6499714.000000
6922127.000000
25869385.833333
102971758.888889
13920339.500000
7950030.000000
8652251.000000
57660387.818182
27362798.333333
9191692.00...

result:

ok 2000 numbers

Test #24:

score: 10
Accepted
time: 3ms
memory: 227672kb

input:

2000
1 2 1 4 4 3 3 4 6 2 5 10 11 9 11 16 13 12 6 12 19 12 14 9 23 8 8 28 5 14 21 20 8 5 5 16 9 33 39 24 25 3 19 29 15 7 46 39 32 42 45 13 34 40 21 29 29 39 18 59 59 18 43 37 29 43 31 22 66 40 47 47 56 25 58 60 62 68 51 41 51 42 64 46 54 84 85 52 74 70 67 48 76 49 89 82 69 49 77 58 62 75 99 100 102 7...

output:

783353173.857143
204903172.454545
229172725.625000
785254461.148058
16952640.900000
329675480.375000
199435398.000000
182894354.222222
787160780.527981
484557370.500000
15562280.125000
18638362.111111
965693369.000000
17293135.714286
789093560.138272
13909962.000000
5903698.000000
26403268.000000
19...

result:

ok 2000 numbers

Test #25:

score: 10
Accepted
time: 3ms
memory: 226032kb

input:

2000
1 1 2 1 2 3 5 8 9 4 9 1 1 9 8 6 8 1 8 9 14 16 7 4 10 13 19 24 21 23 6 3 28 21 8 33 21 17 26 20 25 27 11 28 21 42 32 27 16 30 28 29 31 25 8 51 31 54 12 38 15 23 21 28 42 33 30 54 38 33 53 71 71 33 38 74 45 57 77 69 76 80 81 64 51 66 83 52 75 49 47 86 74 52 81 53 66 65 72 86 57 73 69 100 96 96 70...

output:

712379791.027778
730937711.625000
594520594.142857
783452017.714286
750107897.272727
327405835.666667
533643015.724138
760578428.700000
716674385.666667
530704206.000000
873840570.000000
558880384.000000
700766288.000000
681959792.000000
625729506.500000
938710024.000000
188207878.000000
13054864.00...

result:

ok 2000 numbers

Test #26:

score: 10
Accepted
time: 7ms
memory: 226668kb

input:

2000
1 2 2 3 3 3 7 2 6 2 8 4 13 14 1 8 13 17 13 15 13 10 11 22 24 12 22 16 6 6 10 14 13 30 10 25 27 20 37 5 13 27 14 19 21 1 24 42 21 36 36 4 46 30 41 41 51 22 10 15 22 19 27 28 20 42 42 47 22 58 68 37 56 63 51 40 36 45 40 59 62 56 73 58 62 45 75 87 78 63 67 66 48 49 51 68 85 68 55 64 64 88 98 80 99...

output:

862103310.000000
646331770.147059
647879605.208955
937931035.000000
846045856.000000
653605854.854839
647401386.578947
763227900.000000
356421127.000000
664412500.560000
583588916.750000
678335454.333333
656739042.625000
502026450.333333
594368949.000000
276432795.000000
655475682.846154
277269238.0...

result:

ok 2000 numbers

Test #27:

score: 10
Accepted
time: 23ms
memory: 226992kb

input:

2000
1 2 1 1 5 3 2 3 2 2 5 12 7 12 14 5 8 7 15 11 2 2 1 17 21 13 6 19 16 17 7 24 29 23 7 9 4 17 18 22 16 30 4 44 18 4 44 33 41 30 2 1 50 39 8 52 54 25 18 25 57 8 39 14 10 19 49 50 28 28 29 60 15 28 65 3 43 70 16 52 65 47 30 34 37 51 54 55 86 39 70 87 86 80 27 54 6 93 75 93 98 18 68 85 60 98 45 18 78...

output:

822926380.296296
836531986.521739
864103360.333333
725945381.133333
779930151.909091
789866906.571429
724645048.263158
905205645.000000
849643920.000000
801687438.200000
801268636.583333
734015025.600000
639833705.000000
726743008.437500
952865396.500000
836581070.000000
856314314.000000
745403493.6...

result:

ok 2000 numbers

Test #28:

score: 10
Accepted
time: 8ms
memory: 226544kb

input:

2000
1 1 1 4 5 1 3 5 3 5 6 2 4 1 9 13 11 11 7 6 16 9 4 16 14 12 4 2 24 16 5 22 17 22 13 24 25 38 1 7 6 18 2 42 19 43 19 23 3 47 14 45 30 37 25 9 44 44 11 55 51 7 8 21 33 66 49 63 9 53 21 13 58 21 37 63 4 31 60 65 52 7 10 18 68 20 43 53 45 62 85 64 40 41 35 7 72 50 89 85 57 49 90 93 60 63 44 37 8 85 ...

output:

618462437.884615
567825893.250000
567302445.325581
619847729.736842
628079388.062500
587316194.777778
576029985.333333
592047118.095238
572320227.069767
534341960.277778
562681987.437500
572746051.138889
580113553.028571
559118719.562500
538947369.789474
575533376.281250
536657931.625000
565465885.1...

result:

ok 2000 numbers

Test #29:

score: 10
Accepted
time: 8ms
memory: 227604kb

input:

2000
1 2 1 3 3 5 1 8 2 2 7 10 9 5 7 16 5 2 10 18 18 14 16 24 7 14 24 2 10 11 19 29 2 16 12 18 19 5 16 10 35 12 37 14 28 20 10 8 38 8 22 9 33 16 3 14 22 47 18 32 56 58 6 22 22 39 36 33 17 40 10 46 29 17 17 11 11 21 62 20 51 7 47 52 83 81 7 60 61 83 42 69 82 77 48 77 44 58 23 23 29 33 63 63 102 49 36 ...

output:

640682607.677419
654794201.896552
623724048.018519
563367862.000000
629996062.617021
578005048.625000
644883765.951220
609658376.514286
627572405.100000
666070655.538462
552742688.000000
596053806.621622
709927841.857143
627611216.000000
589146389.071429
686680999.000000
645314898.450000
632111236.0...

result:

ok 2000 numbers

Test #30:

score: 10
Accepted
time: 15ms
memory: 227152kb

input:

2000
1 2 1 4 5 2 5 8 5 3 4 11 3 4 9 1 4 11 14 18 19 11 21 13 22 9 15 13 14 24 9 22 31 33 23 16 33 19 34 21 10 40 40 28 30 24 9 45 28 28 20 2 12 15 22 55 54 10 18 25 56 24 42 28 36 13 63 48 49 34 16 56 1 14 27 1 1 31 43 50 71 20 61 72 50 57 53 11 15 65 2 1 24 87 33 77 33 54 26 91 43 12 53 44 6 101 95...

output:

875749748.750000
980775550.000000
792393684.733333
877334746.000000
892872799.250000
692917302.444444
844673232.000000
968336393.000000
809407059.000000
841448499.666667
802109709.227273
822804828.666667
689116482.250000
820686932.666667
800229910.850000
798255653.125000
304917219.400000
819832041.4...

result:

ok 2000 numbers

Test #31:

score: 10
Accepted
time: 7ms
memory: 227088kb

input:

2000
1 2 3 2 1 5 2 7 1 10 6 2 11 4 3 16 10 3 14 12 3 22 9 15 11 11 17 6 16 15 14 14 1 15 32 14 16 29 25 31 3 24 26 37 3 24 38 24 46 5 13 7 31 3 3 32 42 18 16 5 46 60 57 33 34 55 42 23 63 26 57 62 32 40 57 75 47 73 37 28 57 70 78 6 82 86 61 53 17 60 3 7 19 10 36 72 55 95 45 5 15 22 34 57 105 58 18 69...

output:

947322572.500000
829209491.375000
924970046.000000
856705493.000000
797400719.555556
800729961.250000
740208777.000000
711780199.500000
712300705.833333
992631065.500000
993761731.000000
770162261.500000
636860759.500000
797242815.421053
782755634.857143
808236147.090909
869281318.000000
758291711.0...

result:

ok 2000 numbers

Subtask #2:

score: 0
Runtime Error

Test #32:

score: 0
Runtime Error

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:


result:


Subtask #3:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Test #37:

score: 0
Runtime Error

input:

50000
1 2 2 1 3 5 3 8 6 9 10 4 3 8 9 11 14 9 9 13 8 3 14 10 1 21 12 18 27 13 24 11 33 19 34 26 33 21 19 19 40 22 12 32 29 33 12 11 42 48 51 16 51 17 7 5 49 21 50 58 16 37 15 30 6 43 22 63 22 33 56 52 14 45 75 12 66 1 70 78 46 7 8 10 21 68 9 85 40 51 73 17 48 74 57 62 14 51 21 79 74 58 66 13 94 46 3 ...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #2:

0%