QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623042#6199. 数圈圈zhouhuanyi65 402ms135484kbC++235.9kb2024-10-09 09:46:062024-10-09 09:46:06

Judging History

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

  • [2024-10-09 09:46:06]
  • 评测
  • 测评结果:65
  • 用时:402ms
  • 内存:135484kb
  • [2024-10-09 09:46:06]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define N 200000
#define K 19
#define M 524288
#define mod 998244353
#define g 3
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int fast_pow(int a,int b)
{
	int res=1,mul=a;
	while (b)
	{
		if (b&1) res=1ll*res*mul%mod;
		mul=1ll*mul*mul%mod,b>>=1;
	}
	return res;
}
void Adder(int &x,int d)
{
	x=x+d>=mod?x+d-mod:x+d;
	return;
}
void Adder2(int &x,int d)
{
	x=x+d<0?x+d+mod:x+d;
	return;
}
int MD(int x)
{
	return x>=mod?x-mod:x;
}
int MD2(int x)
{
	return x<0?x+mod:x;
}
int n,y,length,a[N+1],ans[N+1],num[M+1],A[M+1],B[M+1],rev[M+1],wn[K+1][M+1],wn2[K+1][M+1];
void NTT(int limit,int *s,int type)
{
	int s1,s2;
	for (int i=1;i<limit;++i) rev[i]=(rev[i>>1]>>1)|((i&1)?limit>>1:0);
	for (int i=0;i<limit;++i)
		if (rev[i]>i)
			swap(s[i],s[rev[i]]);
	if (type==1)
	{
		for (int i=2;i<=limit;i<<=1)
			for (int j=0;j+i-1<limit;j+=i)
				for (int k=j;k<(j|(i>>1));++k)
					s1=s[k],s2=1ll*s[k|(i>>1)]*wn[num[i]][k-j]%mod,s[k]=MD(s1+s2),s[k+(i>>1)]=MD2(s1-s2);
	}
	else
	{
		for (int i=2;i<=limit;i<<=1)
			for (int j=0;j+i-1<limit;j+=i)
				for (int k=j;k<(j|(i>>1));++k)
					s1=s[k],s2=1ll*s[k|(i>>1)]*wn2[num[i]][k-j]%mod,s[k]=MD(s1+s2),s[k+(i>>1)]=MD2(s1-s2);
		s1=fast_pow(limit,mod-2);
		for (int i=0;i<=limit;++i) s[i]=1ll*s[i]*s1%mod;
	}
	return;
}
vector<int>operator * (vector<int>a,vector<int>b)
{
	if (a.empty()) return a;
	if (b.empty()) return b;
	vector<int>c(a.size()+b.size()-1);
	if (min(a.size(),b.size())<=50)
	{
		for (int i=0;i<a.size();++i)
			for (int j=0;j<b.size();++j)
				Adder(c[i+j],1ll*a[i]*b[j]%mod);
		return c;
	}
	int limit=1;
	while (limit<=a.size()+b.size()) limit<<=1;
	for (int i=0;i<=limit;++i) A[i]=B[i]=0;
	for (int i=0;i<a.size();++i) A[i]=a[i];
	for (int i=0;i<b.size();++i) B[i]=b[i];
	NTT(limit,A,1),NTT(limit,B,1);
	for (int i=0;i<=limit;++i) A[i]=1ll*A[i]*B[i]%mod;
	NTT(limit,A,-1);
	for (int i=0;i<c.size();++i) c[i]=A[i];
	return c;
}
vector<int>operator / (vector<int>a,vector<int>b)
{
	vector<int>c(a.size()-b.size()+1);
	if (min(b.size(),c.size())<=50)
	{
		for (int i=0;i<c.size();++i)
			for (int j=0;j<b.size();++j)
				Adder(c[i],1ll*b[j]*a[i+j]%mod);
		return c;
	}
	int limit=1;
	while (limit<=a.size()) limit<<=1;
	for (int i=0;i<=limit;++i) A[i]=B[i]=0;
	for (int i=0;i<a.size();++i) A[i]=a[i];
	for (int i=0;i<b.size();++i) B[b.size()-i]=b[i];
	NTT(limit,A,1),NTT(limit,B,1);
	for (int i=0;i<=limit;++i) A[i]=1ll*A[i]*B[i]%mod;
	NTT(limit,A,-1);
	for (int i=0;i<c.size();++i) c[i]=A[b.size()+i];
	return c;
}
vector<int>operator ^ (vector<int>a,vector<int>b)
{
	vector<int>c(a.size());
	if (min(b.size(),c.size())<=50)
	{
		for (int i=0;i<c.size();++i)
			for (int j=0;j<b.size()&&i+j<a.size();++j)
				Adder(c[i],1ll*b[j]*a[i+j]%mod);
		return c;
	}
	int limit=1;
	while (limit<=a.size()+b.size()) limit<<=1;
	for (int i=0;i<=limit;++i) A[i]=B[i]=0;
	for (int i=0;i<a.size();++i) A[i]=a[i];
	for (int i=0;i<b.size();++i) B[b.size()-i]=b[i];
	NTT(limit,A,1),NTT(limit,B,1);
	for (int i=0;i<=limit;++i) A[i]=1ll*A[i]*B[i]%mod;
	NTT(limit,A,-1);
	for (int i=0;i<c.size();++i) c[i]=A[b.size()+i];
	return c;
}
void calc_inv(int len,int *s1,int *s2)
{
	if (len==1)
	{
		s2[0]=fast_pow(s1[0],mod-2);
		return;
	}
	int limit=1;
	while (limit<=(len<<1)) limit<<=1;
	calc_inv((len+1)>>1,s1,s2);
	int s3[limit+1];
	for (int i=0;i<=limit;++i) s2[i]=(i<((len+1)>>1))?s2[i]:0,s3[i]=(i<len)?s1[i]:0;
	NTT(limit,s2,1),NTT(limit,s3,1);
	for (int i=0;i<=limit;++i) s2[i]=MD2(2ll*s2[i]%mod-1ll*s2[i]*s2[i]%mod*s3[i]%mod);
	NTT(limit,s2,-1);
	for (int i=0;i<=limit;++i) s2[i]=(i<len)?s2[i]:0;
	return;
}
vector<int>get_inv(int len,vector<int>p)
{
	vector<int>v(len);
	for (int i=0;i<min(len,(int)(p.size()));++i) A[i]=p[i];
	calc_inv(len,A,B);
	for (int i=0;i<len;++i) v[i]=B[i];
	return v;
}
vector<int>solve(int l,int r)
{
	if (l==r) return {1,a[l]};
	int mid=(l+r)>>1;
	return solve(l,mid)*solve(mid+1,r);
}
struct seg
{
	struct node
	{
		int l,r;
		vector<int>data;
	};
	node tree[(N<<2)+1];
	void push_up(int k)
	{
		tree[k].data=tree[k<<1].data*tree[k<<1|1].data;
		return;	
	}
	void build(int k,int l,int r)
	{
		tree[k].l=l,tree[k].r=r;
		if (l==r)
		{
			tree[k].data={1,MD2(-l)};
			return;
		}
		int mid=(l+r)>>1;
		build(k<<1,l,mid),build(k<<1|1,mid+1,r),push_up(k);
		return;
	}
	void solve(int k,vector<int>p)
	{
		if (tree[k].l==tree[k].r)
		{
			ans[tree[k].l]=p[0];
			return;
		}
		int mid=(tree[k].l+tree[k].r)>>1;
		vector<int>p1=p/tree[k<<1|1].data;
		vector<int>p2(tree[k].r-mid);
		for (int i=0;i<p2.size();++i) p2[i]=p[i+mid-tree[k].l+1];
		solve(k<<1,p1),solve(k<<1|1,p2);
		return;
	}
};
seg T;
int main()
{
	vector<int>p;
	bool op=1;
	for (int i=2,w;i<=M;i<<=1)
	{
		num[i]=++length,w=fast_pow(g,(mod-1)/i);
		for (int j=0,res=1;j<(i>>1);++j,res=1ll*res*w%mod) wn[num[i]][j]=res;
		w=fast_pow(g,(mod-1)/i*(i-1));
		for (int j=0,res=1;j<(i>>1);++j,res=1ll*res*w%mod) wn2[num[i]][j]=res;
	}
	n=read(),y=read();
	for (int i=1;i<=n;++i) a[i]=read(),op&=(a[i-1]<=a[i]);
	if (op)
	{
		for (int i=1;i<=n;++i)
			if (a[i]>=i)
				Adder(a[i],y-1);
		for (int i=1;i<=n;++i) a[i]=MD2(a[i]-i+1);
		p=solve(1,n),T.build(1,0,n),reverse(p.begin(),p.end());
		p=p^get_inv(n+1,T.tree[1].data),p.resize(n+1),T.solve(1,p);
		for (int i=0;i<=n;++i) printf("%d ",ans[n-i]);
		puts("");
	}
	else
	{
		reverse(a+1,a+n+1);
		for (int i=1;i<=n;++i)
			if (a[i]>=n-i+1)
				Adder(a[i],y-1);
		for (int i=1;i<=n;++i) a[i]=MD2(a[i]-i+1);
		p=solve(1,n),T.build(1,0,n),reverse(p.begin(),p.end());
		p=p^get_inv(n+1,T.tree[1].data),p.resize(n+1),T.solve(1,p);
		for (int i=0;i<=n;++i) printf("%d ",ans[n-i]);
		puts("");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 8ms
memory: 114516kb

input:

1 915080344
1

output:

1 915080344 

result:

ok 2 number(s): "1 915080344"

Test #2:

score: 1
Accepted
time: 8ms
memory: 115832kb

input:

1 915080344
0

output:

1 0 

result:

ok 2 number(s): "1 0"

Test #3:

score: 1
Accepted
time: 12ms
memory: 115808kb

input:

8 60641044
8 8 8 8 8 8 8 8

output:

1 485128408 47996075 379627744 150492470 955348304 893852780 400745432 184663991 

result:

ok 9 numbers

Test #4:

score: 1
Accepted
time: 16ms
memory: 119312kb

input:

8 5015523
0 0 0 0 0 0 0 1

output:

1 1 0 0 0 0 0 0 0 

result:

ok 9 numbers

Test #5:

score: 1
Accepted
time: 7ms
memory: 119688kb

input:

6 469476507
0 0 3 4 4 4

output:

1 938953027 685386746 814057889 85780770 0 0 

result:

ok 7 numbers

Test #6:

score: 1
Accepted
time: 3ms
memory: 119716kb

input:

8 430768932
0 2 2 3 4 6 6 7

output:

1 861537892 8385549 91551398 546166364 364018503 783811192 746026358 0 

result:

ok 9 numbers

Test #7:

score: 1
Accepted
time: 8ms
memory: 119412kb

input:

7 861726531
0 0 6 6 6 6 6

output:

1 452173091 675192946 823218157 246524395 422107531 0 0 

result:

ok 8 numbers

Subtask #2:

score: 9
Accepted

Test #8:

score: 9
Accepted
time: 8ms
memory: 119940kb

input:

15 0
1 1 1 3 6 8 10 11 11 12 13 13 14 15 15

output:

1 122 6222 173976 2941896 31329936 212468976 908747712 384836990 634979325 959428094 118389247 151372800 4147200 0 0 

result:

ok 16 numbers

Test #9:

score: 9
Accepted
time: 12ms
memory: 119100kb

input:

15 0
0 0 0 0 0 0 0 0 0 0 13 14 14 14 14

output:

1 65 1563 17268 86988 158400 0 0 0 0 0 0 0 0 0 0 

result:

ok 16 numbers

Test #10:

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

input:

15 0
3 7 7 7 7 7 7 7 7 10 10 10 10 10 10

output:

1 111 5069 124376 1797880 15805440 84299040 264216960 454083840 373161600 105840000 0 0 0 0 0 

result:

ok 16 numbers

Test #11:

score: 9
Accepted
time: 12ms
memory: 116200kb

input:

15 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 10

output:

1 11 9 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok 16 numbers

Test #12:

score: 9
Accepted
time: 7ms
memory: 116108kb

input:

15 0
0 0 2 5 5 5 7 7 11 11 13 15 15 15 15

output:

1 116 5599 147353 2329717 23009526 143249418 555150240 297223999 718560223 175587487 352356480 34439040 552960 0 0 

result:

ok 16 numbers

Test #13:

score: 9
Accepted
time: 3ms
memory: 114712kb

input:

1 0
1

output:

1 0 

result:

ok 2 number(s): "1 0"

Subtask #3:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #14:

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

input:

1999 534253321
3 4 6 7 7 8 8 8 9 11 12 14 14 15 16 17 18 18 19 19 19 20 22 22 26 27 28 30 31 32 34 34 35 35 35 36 37 37 38 40 42 43 44 45 47 48 50 51 52 52 52 53 54 55 55 55 57 57 58 59 61 62 64 65 65 66 66 69 69 69 69 69 71 72 72 73 73 74 76 77 79 79 81 81 82 84 85 86 86 88 92 94 95 97 97 98 99 99 ...

output:

1 953211139 257568325 220501105 623433961 180031559 833037467 396983849 209899998 53230560 141504779 968307116 372883144 837211358 802540431 812215686 328261448 263381741 600310675 795356284 742542522 498781038 872853450 580687976 717285974 83199455 314428424 264355776 63288458 576374064 529079484 5...

result:

ok 2000 numbers

Test #15:

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

input:

1999 796334686
0 0 2 4 4 7 7 9 9 9 12 12 12 12 12 12 14 14 16 16 19 23 23 23 23 26 28 28 29 30 30 31 37 37 37 37 37 39 39 39 39 39 39 39 39 41 43 45 46 46 48 48 51 51 54 54 54 55 56 59 59 59 59 59 59 59 61 61 61 61 61 62 66 66 69 69 69 71 71 71 72 72 72 74 81 81 84 89 89 94 95 97 99 101 101 101 102 ...

output:

1 536002349 937757160 289425713 907882641 321783010 595662029 556853988 786788251 529488064 794023762 421672954 686250945 968035887 784085910 575322365 429895268 902593974 1846999 293576649 428461188 235553244 257045333 570459588 747748543 856031574 169520023 560332363 980410837 392913972 367618628 ...

result:

ok 2000 numbers

Test #16:

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

input:

1999 305107443
0 0 0 0 0 0 0 0 0 0 3 3 3 9 11 11 14 14 14 17 24 24 24 24 26 26 26 26 29 29 29 34 34 37 37 37 39 42 42 42 42 42 42 42 42 47 48 48 48 50 50 54 54 54 57 57 57 63 63 63 72 72 72 72 72 81 81 81 81 81 81 81 87 92 92 95 99 99 99 102 108 108 108 108 108 108 108 108 108 109 109 109 109 109 10...

output:

1 969126377 537226299 728367360 209560166 989924837 253940627 427351981 914061019 628496118 734719309 252926245 583312948 68786973 258073259 910788167 299137224 885656052 875969853 354404451 45716584 320441751 277290512 954948659 211035762 146845140 494632707 610355600 899795592 163072490 635966446 ...

result:

ok 2000 numbers

Test #17:

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

input:

1998 709560295
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

1 5774 12268627 333251810 968490666 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 1999 numbers

Test #18:

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

input:

1998 692932808
1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 ...

output:

1 917063734 948290819 579651779 337834497 220466570 90399482 618308924 735098912 260820378 131547200 700587221 174762056 363003551 158023649 403987675 152162315 356539929 214887886 516517666 514687892 843687841 780208121 404306050 676949444 844822526 575059869 466021734 937954972 852880314 430298147...

result:

ok 1999 numbers

Subtask #4:

score: 15
Accepted

Test #19:

score: 15
Accepted
time: 358ms
memory: 128696kb

input:

74999 1
1 2 3 3 4 4 4 4 4 4 4 4 7 8 8 9 9 9 10 13 13 14 14 16 19 20 21 22 24 25 25 26 26 29 31 32 32 35 35 36 38 39 39 40 41 43 43 44 45 45 45 46 48 49 50 50 50 51 53 54 57 59 59 60 60 62 63 63 65 66 69 71 73 76 78 78 78 79 79 79 80 81 81 81 82 82 83 83 85 87 89 91 94 94 94 94 98 99 99 100 100 101 1...

output:

1 807105292 537696219 610871672 756717333 747157840 985309412 316444724 4802021 90316406 621421837 305090049 478191790 223850716 219051144 121441365 268817000 978289746 492431266 833292870 839237110 759699972 46580823 862146014 473655237 128314819 561257853 850935318 484875172 378222513 272936860 96...

result:

ok 75000 numbers

Test #20:

score: 15
Accepted
time: 354ms
memory: 131664kb

input:

74999 1
0 1 1 5 5 9 10 10 10 13 15 15 17 17 21 22 22 25 25 25 25 25 25 26 28 31 34 34 34 34 34 34 34 37 38 38 40 45 49 51 52 54 54 55 56 56 56 57 57 58 58 58 58 60 60 61 62 65 65 66 66 67 68 68 68 69 70 71 72 75 76 77 80 80 84 84 85 85 85 87 88 91 91 92 92 92 93 93 95 95 98 98 101 101 101 102 103 10...

output:

1 809431479 431679436 745604714 274613200 170845755 972132537 55258076 566832107 703587537 255584408 865645822 781167728 128956434 647451374 453646508 860240265 653463769 349103187 407111131 489423931 547820728 669386176 621350649 926240688 684576054 927984065 817570142 967041790 872876323 882626118...

result:

ok 75000 numbers

Test #21:

score: 15
Accepted
time: 372ms
memory: 127868kb

input:

74999 1
0 0 0 0 0 0 0 18 18 18 18 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 39 39 39 39 39 39 39 39 39 39 39 54 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 89 99 99 99 99 99 99 99 99...

output:

1 774366659 252392262 347329163 340414805 275079579 565935714 318788631 695378325 748441382 794519184 968104341 263768944 200824369 754329069 964829486 536012423 201895770 779803729 380233347 506701939 370768820 237624420 46204107 763538604 937303053 116947163 900083251 737076479 483438725 247316583...

result:

ok 75000 numbers

Test #22:

score: 15
Accepted
time: 360ms
memory: 131544kb

input:

75000 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

1 226695 993360781 442055138 331012017 607366299 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 75001 numbers

Test #23:

score: 15
Accepted
time: 357ms
memory: 131164kb

input:

75000 1
75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 75000 7500...

output:

1 633778235 682800846 900917551 827745846 333143417 956198775 546386510 304075324 487918550 585084320 745621827 153618291 118618492 110796003 245301990 168389905 109299392 337405718 359523920 138148837 538128669 596898802 51963757 198005608 825432925 717670865 866790073 405862978 495143472 907800353...

result:

ok 75001 numbers

Subtask #5:

score: 15
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #24:

score: 15
Accepted
time: 378ms
memory: 135484kb

input:

99998 570319210
0 2 4 5 5 5 5 6 8 9 10 11 11 11 12 13 15 15 15 17 19 20 20 22 23 24 25 27 29 30 31 31 33 34 34 34 36 36 37 41 42 45 46 47 49 51 52 52 52 53 53 53 53 53 53 53 53 55 55 57 57 59 60 62 64 66 67 67 69 69 71 73 74 74 74 75 77 77 77 79 81 81 82 83 84 84 84 84 85 85 85 85 86 87 87 88 88 88 ...

output:

1 254159112 695091019 76200996 194881011 486524727 962331020 580279528 216192371 579516537 117752898 650463852 266182730 852393522 218765530 404450544 703284631 375581274 49238872 136114742 774891399 556888692 905956990 181243785 458446438 371930401 797533442 604170391 343401393 375298580 55803340 1...

result:

ok 99999 numbers

Test #25:

score: 15
Accepted
time: 390ms
memory: 132876kb

input:

99998 1602034
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

1 547745564 589634237 211754739 372198749 301290037 776606908 214126509 189150478 328195052 880272812 909532555 863373078 430080293 537199509 318806135 8196228 648166201 427875664 650766730 58570353 987238669 39344997 822803720 715320750 80394724 229559955 617549125 287639770 212831140 233279223 403...

result:

ok 99999 numbers

Test #26:

score: 15
Accepted
time: 374ms
memory: 132308kb

input:

100000 68781382
99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99996 99...

output:

1 251863769 757007199 676539332 784265265 279389420 19955056 575699984 691301941 946583855 845025307 855962208 699428975 601485243 135664495 408411664 378508307 348219869 932108293 339888586 667557052 601618818 574156182 209891366 749720677 748859147 152413801 299714880 694312547 381010539 527432353...

result:

ok 100001 numbers

Test #27:

score: 15
Accepted
time: 402ms
memory: 132924kb

input:

99998 410207512
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

1 5982187 95034578 508118599 796964854 694103721 471284217 204564545 725289182 107930170 181340324 320547673 911812535 208848571 522230026 392190383 779987231 887736240 330472568 707983291 935610857 76278406 428565057 41252090 250362869 803469521 305517755 8112887 167496930 868162963 248518288 44341...

result:

ok 99999 numbers

Subtask #6:

score: 0
Wrong Answer

Test #28:

score: 0
Wrong Answer
time: 3ms
memory: 116028kb

input:

15 0
15 15 15 13 13 13 12 10 10 9 9 6 6 4 2

output:

1 143 8670 293058 6112008 82271448 727061040 220313548 772302705 782736732 722744270 1152986 474266611 766389247 49766400 0 

result:

wrong answer 3rd numbers differ - expected: '8673', found: '8670'

Subtask #7:

score: 0
Skipped

Dependency #6:

0%

Subtask #8:

score: 15
Accepted

Test #38:

score: 15
Accepted
time: 360ms
memory: 129000kb

input:

74999 604849250
72634 60382 41531 20689 20667 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

1 29729089 502541730 987819491 152643448 207549990 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 75000 numbers

Test #39:

score: 15
Accepted
time: 362ms
memory: 129076kb

input:

74998 268061328
74998 74998 74998 74997 74997 74996 74996 74996 74995 74995 74993 74991 74989 74989 74989 74988 74988 74986 74986 74985 74984 74984 74983 74979 74976 74975 74975 74975 74971 74970 74969 74968 74966 74965 74965 74965 74960 74957 74957 74955 74952 74950 74950 74946 74946 74945 74945 74...

output:

1 496217481 38945150 977865275 561558774 26201207 627080785 827237068 274839991 866012127 461850303 435622894 901366572 594737385 916926178 67342455 385506320 802912121 76946916 88058709 258241852 84015930 817394206 858824839 234937518 157055553 652948782 150767840 297815791 642228020 858605835 1444...

result:

ok 74999 numbers

Test #40:

score: 15
Accepted
time: 364ms
memory: 128764kb

input:

74998 429690078
74998 74998 74998 74998 74997 74997 74997 74996 74995 74994 74994 74991 74990 74989 74988 74988 74988 74987 74987 74986 74985 74983 74983 74982 74982 74981 74978 74977 74977 74975 74974 74974 74974 74974 74973 74972 74971 74970 74968 74968 74968 74966 74966 74966 74964 74962 74962 74...

output:

1 5048119 402198736 279697343 571601446 168938687 157141472 32691301 761690372 113753564 255854669 718533600 5797670 807392609 323727133 211316564 476204251 648831988 9111559 490303879 593946617 303483317 625941589 560494984 954524080 728242856 693399623 374012123 683780629 383276502 519590565 24165...

result:

ok 74999 numbers

Test #41:

score: 15
Accepted
time: 360ms
memory: 127732kb

input:

74998 225485734
74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74998 74...

output:

1 451012575 60358176 469340195 950434404 676047688 940571305 965103037 296316200 755679022 697725867 82110221 209097534 610674627 528341971 307208555 763908082 418300040 210402115 12470843 276983349 769971543 651324021 521748318 123701994 431787772 298007148 270821869 762533309 322245179 385403519 4...

result:

ok 74999 numbers

Subtask #9:

score: 0
Skipped

Dependency #6:

0%