QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#787378#9650. 链覆盖zhouhuanyi65 962ms362560kbC++143.5kb2024-11-27 11:25:002024-11-27 11:25:02

Judging History

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

  • [2024-11-27 11:25:02]
  • 评测
  • 测评结果:65
  • 用时:962ms
  • 内存:362560kb
  • [2024-11-27 11:25:00]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cassert>
#define N 81
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 n,sz,mod,d,tres=1,inv[N+1],Cs[N+1][N+1],ans[N+1][N+1],dp[N+1][N+1][N+1][N+1],DP[N+1][N+1][N+1][N+1],A[N+1][N+1][N+1],B[N+1][N+1][N+1],C[N+1][N+1][N+1],maxn[N+1][N+1],maxn2[N+1][N+1];
long long delta[N+1][N+1][N+1];
unsigned long long smod;
int MD(int x)
{
	return x>=mod?x-mod:x;
}
int MD2(int x)
{
	return x<0?x+mod:x;
}
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 mul(int x,int y)
{
	long long d=1ll*x*y;
	d-=(((unsigned __int128)(d)*smod)>>62)*mod;
	return d>=mod?d-mod:d;
}
int main()
{
	int rst;
	n=read(),mod=read(),smod=(1ull<<62)/mod,inv[1]=1;
	for (int i=2;i<=N;++i) inv[i]=MD2(-1ll*inv[mod%i]*(mod/i)%mod);
	for (int i=0;i<=N;++i) Cs[i][0]=1;
	for (int i=1;i<=N;++i)
		for (int j=1;j<=i;++j)
			Cs[i][j]=MD(Cs[i-1][j-1]+Cs[i-1][j]);
	for (int i=1;i<=n-2;++i) tres=1ll*tres*n%mod;
    Adder(ans[1][n],tres);
	for (int i=1;i<=n;++i)
	{
		sz=n/i;
		for (int j=1;j<=n;++j)
			for (int k=0;k<=i;++k)
			{
				if (k==i)
				{
					for (int t=0;t<=sz;++t)
						for (int w=0;w<=n;++w)
							dp[j][k][t][w]=DP[j][k][t][w]=0;
				}
				else dp[j][k][0][0]=DP[j][k][0][0]=0;
			}
		DP[0][0][0][0]=1;
		for (int j=0;j<=n;++j)
			for (int k=0;k<=min(i,j);++k)
			{
				if (k!=i) maxn[j][k]=maxn2[j][k]=0;
				else maxn[j][k]=j/i,maxn2[j][k]=j;
			}
		for (int j=1;j<=n;++j)
		{
			for (int k=0;k<=min(i,j-1);++k)
				for (int t=0;t<=maxn[j-1][k];++t)
					for (int w=0;w<=maxn2[j-1][k];++w)
						if (DP[j-1][k][t][w])
						{
							if (k+1==i) rst=i;
							else if (k+1>i) rst=1;
							else rst=0;
							Adder(dp[j][min(k+1,i)][t+(k+1==i)][w+rst],mul(DP[j-1][k][t][w],j));
						}
			for (int k=1;k<=j;++k)
			{
				d=min(max(k,j-k),i);
				for (int t=0;t<=d;++t)
					for (int z=0;z<=maxn[j][t];++z)
						for (int w=0;w<=maxn2[j][t];++w)
							A[t][z][w]=dp[k][t][z][w],B[t][z][w]=DP[j-k][t][z][w],delta[t][z][w]=0;
				for (int t=1;t<=d;++t) Adder(A[t][0][0],A[t-1][0][0]),Adder(B[t][0][0],B[t-1][0][0]);
				for (int t=0;t<=d;++t)
					for (int z=0;z<=maxn[k][t];++z)
						for (int w=0;w<=maxn2[k][t];++w)
							if (A[t][z][w])
							{
								for (int z2=0;z2<=maxn[j-k][t];++z2)
									for (int w2=0;w2<=maxn2[j-k][t];++w2)
										if (B[t][z2][w2])
											delta[t][z+z2][w+w2]+=mul(A[t][z][w],B[t][z2][w2]);
							}
				for (int t=0;t<=d;++t)
					for (int z=0;z<=maxn[j][t];++z)
						for (int w=0;w<=maxn2[j][t];++w)
							C[t][z][w]=delta[t][z][w]%mod;
				for (int t=d;t>=1;--t) Adder2(C[t][0][0],-C[t-1][0][0]);
				for (int t=0;t<=d;++t)
					for (int z=0;z<=maxn[j][t];++z)
						for (int w=0;w<=maxn2[j][t];++w)
							if (C[t][z][w])
								Adder(DP[j][t][z][w],mul(C[t][z][w],Cs[j-1][k-1]));
			}
		}
		for (int j=0;j<=i;++j)
			for (int k=0;k<=maxn[n][j];++k)
				for (int t=0;t<=maxn2[n][j];++t)
					if (dp[n][j][k][t])
					{
						for (int w=k+1;w<=n&&t+(i-1)*(w-k)<=n;++w) Adder(ans[w][t+(i-1)*(w-k)],1ll*dp[n][j][k][t]*inv[n]%mod);
						for (int w=k+1;w<=n&&t+i*(w-k)<=n;++w) Adder2(ans[w][t+i*(w-k)],-1ll*dp[n][j][k][t]*inv[n]%mod);
					}
	}
	for (int i=1;i<=n;++i)
	{
		for (int j=1;j<=n;++j) printf("%d ",ans[i][j]);
		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: 2ms
memory: 16272kb

input:

1 1033582741

output:

1 

result:

ok 1 number(s): "1"

Test #2:

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

input:

2 615397207

output:

0 1 
0 1 

result:

ok 4 number(s): "0 1 0 1"

Test #3:

score: 1
Accepted
time: 4ms
memory: 24472kb

input:

3 788354159

output:

0 1 2 
0 0 3 
0 0 3 

result:

ok 9 numbers

Test #4:

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

input:

4 527696509

output:

0 1 9 6 
0 0 1 15 
0 0 0 16 
0 0 0 16 

result:

ok 16 numbers

Test #5:

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

input:

5 1047477317

output:

0 1 40 60 24 
0 0 1 28 96 
0 0 0 1 124 
0 0 0 0 125 
0 0 0 0 125 

result:

ok 25 numbers

Subtask #2:

score: 9
Accepted

Dependency #1:

100%
Accepted

Test #6:

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

input:

6 397487711

output:

0 1 195 560 420 120 
0 0 1 75 500 720 
0 0 0 1 75 1220 
0 0 0 0 1 1295 
0 0 0 0 0 1296 
0 0 0 0 0 1296 

result:

ok 36 numbers

Test #7:

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

input:

7 889104253

output:

0 1 1056 5550 6240 3240 720 
0 0 1 186 2820 7680 6120 
0 0 0 1 186 2700 13920 
0 0 0 0 1 186 16620 
0 0 0 0 0 1 16806 
0 0 0 0 0 0 16807 
0 0 0 0 0 0 16807 

result:

ok 49 numbers

Test #8:

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

input:

8 549326861

output:

0 1 6321 59472 94710 68880 27720 5040 
0 0 1 441 14742 77280 111720 57960 
0 0 0 1 441 12642 73500 175560 
0 0 0 0 1 441 12642 249060 
0 0 0 0 0 1 441 261702 
0 0 0 0 0 0 1 262143 
0 0 0 0 0 0 0 262144 
0 0 0 0 0 0 0 262144 

result:

ok 64 numbers

Test #9:

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

input:

9 987498487

output:

0 1 41392 692440 1527456 1426320 792960 262080 40320 
0 0 1 1016 77616 714336 1765680 1619520 604800 
0 0 0 1 1016 54096 573216 1762320 2392320 
0 0 0 0 1 1016 54096 571536 4156320 
0 0 0 0 0 1 1016 54096 4727856 
0 0 0 0 0 0 1 1016 4781952 
0 0 0 0 0 0 0 1 4782968 
0 0 0 0 0 0 0 0 4782969 
0 0 0 0 ...

result:

ok 81 numbers

Test #10:

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

input:

10 328708241

output:

0 1 293607 8753040 26418168 30560544 21213360 9676800 2721600 362880 
0 0 1 2295 439560 6612480 25192944 36847440 24010560 6894720 
0 0 0 1 2295 217800 3961440 21201264 39780720 34836480 
0 0 0 0 1 2295 217800 3916080 21019824 74844000 
0 0 0 0 0 1 2295 217800 3916080 95863824 
0 0 0 0 0 0 1 2295 21...

result:

ok 100 numbers

Subtask #3:

score: 10
Accepted

Dependency #2:

100%
Accepted

Test #11:

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

input:

19 103139489

output:

0 1 11624080 30771297 67633923 38648926 26692097 85413520 76396263 51796363 72312834 18383776 18143658 76958501 63040686 90425144 3215980 40730768 33722922 
0 0 1 2359278 62792309 95551019 80901602 77700549 6042464 88096626 11663760 52681251 62163370 65211259 65287276 68174958 55501818 79883458 3503...

result:

ok 361 numbers

Test #12:

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

input:

15 937882403

output:

0 1 680510166 6779904 292684576 697222660 197217345 608741012 380919310 629991923 761253785 233893766 318988222 847170117 893110124 
0 0 1 114674 776372282 629033371 746821312 437855135 523605947 331874181 762184407 153288444 610819324 375836396 262795034 
0 0 0 1 114674 143592540 421537369 8820850 ...

result:

ok 225 numbers

Test #13:

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

input:

19 474843869

output:

0 1 290796597 19148010 160928809 294278627 383137229 94599672 270994874 382122007 96777052 112881226 301437206 23612615 301660682 123462535 59880830 71981470 162643803 
0 0 1 2359278 145051597 112920521 130345136 77396818 431615648 214934274 57685354 172970869 384868508 1906584 314616519 62416080 12...

result:

ok 361 numbers

Test #14:

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

input:

15 314773379

output:

0 1 275608511 132867935 178856515 48042720 223219485 8946244 169555445 301065994 138265861 98211492 85835693 297975281 300838596 
0 0 1 114674 56697248 104238297 3690076 61545483 125576263 43717518 226820297 539772 129357606 108932984 138966038 
0 0 0 1 114674 143592540 183341211 31948068 157609591 ...

result:

ok 225 numbers

Test #15:

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

input:

12 850098287

output:

0 1 18210093 64283506 405589613 460570147 604022274 382094796 13750278 42837026 379209600 39916800 
0 0 1 11253 20307650 677805480 4111638 35965361 296700839 274301921 813749478 287530513 
0 0 0 1 11253 3135110 153772740 459642866 293113596 705644952 474533686 320629930 
0 0 0 0 1 11253 3135110 1442...

result:

ok 144 numbers

Test #16:

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

input:

20 141298853

output:

0 1 68839881 27636438 89202322 89884444 54389933 18598801 101813771 44020181 98540284 17650821 84948605 99284560 109875380 102603741 73048564 83787674 140097519 125081765 
0 0 1 4980717 99726150 15662794 76473480 22545188 134673435 23448101 79661713 3257746 103213931 86097167 24444057 14404191 43714...

result:

ok 400 numbers

Test #17:

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

input:

19 443521321

output:

0 1 98119531 341747623 108166541 239428661 111284774 323600146 410999963 28515886 192836079 238702839 1528891 117431268 198660948 306492718 102458915 82265644 179706317 
0 0 1 2359278 385884554 443301094 145931375 441121179 38829956 163488943 226138027 50206029 293568156 48331596 120179478 64673609 ...

result:

ok 361 numbers

Test #18:

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

input:

18 931152161

output:

0 1 230694986 520898633 106938344 609847332 364032467 377311321 912977142 682357155 71254508 647595505 486584031 33748863 433489273 466119272 594465132 338724254 
0 0 1 1114095 398962055 854428326 790817123 851140177 607748347 24498673 105237846 352260119 95301968 917346183 54147977 510562573 289151...

result:

ok 324 numbers

Test #19:

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

input:

17 245755819

output:

0 1 93817793 75825682 23216490 203130830 151105808 62208767 60592625 25081550 191941686 236044684 214567479 140179185 245632696 55692699 122481616 
0 0 1 524272 8494826 172250967 15586675 115740856 219080536 5097465 168862711 103863540 142255946 166742737 81698900 111104515 98704006 
0 0 0 1 524272 ...

result:

ok 289 numbers

Test #20:

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

input:

16 855188447

output:

0 1 765021651 433218841 641531 672700608 800355957 92817977 141566065 209409791 325757349 177703536 290381219 768884277 804045026 91232537 
0 0 1 245745 242674969 373792681 335789628 91413642 144102829 91720832 549009449 691721580 156318450 651691192 357474203 177404271 
0 0 0 1 245745 498771210 708...

result:

ok 256 numbers

Subtask #4:

score: 15
Accepted

Dependency #3:

100%
Accepted

Test #21:

score: 15
Accepted
time: 0ms
memory: 114540kb

input:

23 339989921

output:

0 1 128382067 55951455 39285694 255634249 36798575 332202757 192710475 107649991 38554274 256720102 286766617 72690060 295780969 225525043 108057832 309725534 224735581 124067149 177859165 31865929 208865363 
0 0 1 46137322 299930039 271917099 233207861 37064537 113506644 229636054 137833203 1431228...

result:

ok 529 numbers

Test #22:

score: 15
Accepted
time: 0ms
memory: 122636kb

input:

25 187044157

output:

0 1 175788627 52847729 88094570 28022559 127671549 81171328 43554146 84182578 7913574 2175256 173730871 102957150 83686625 84360932 58576766 32609699 94723890 133661796 2361298 21075257 10894054 154573147 185601001 
0 0 1 14282411 89260533 62421771 12706464 165778032 169390164 37102036 158729122 575...

result:

ok 625 numbers

Test #23:

score: 15
Accepted
time: 4ms
memory: 110408kb

input:

22 529921549

output:

0 1 73557520 239128655 461093214 423338402 489284891 429855657 41734166 528373725 443423895 423620229 91183554 260894134 329094316 166366540 234147395 417778987 224941519 354117701 97925348 154486865 
0 0 1 22020075 453327545 53461840 152331027 103438695 287342176 75748048 127592088 236330711 287282...

result:

ok 484 numbers

Test #24:

score: 15
Accepted
time: 8ms
memory: 122660kb

input:

25 375250783

output:

0 1 245550206 77142191 278405034 206563479 181502532 174406539 169881508 229170966 114003440 374404071 129643237 130707276 223546610 85401976 197625875 162316326 56312504 324886119 307131789 79880923 110368787 346599071 357299561 
0 0 1 201326568 373982633 264650191 79743295 372417904 127006408 2686...

result:

ok 625 numbers

Test #25:

score: 15
Accepted
time: 4ms
memory: 112680kb

input:

23 368087911

output:

0 1 364723028 185373355 82684440 247310609 134339090 274974156 118515129 253496474 33849577 132625916 82893865 218243177 310032133 330191574 161341406 301325589 33690102 157006973 96430822 195869590 27510122 
0 0 1 46137322 343926231 314383778 141557241 194034802 90667455 126485135 267428474 1358203...

result:

ok 529 numbers

Test #26:

score: 15
Accepted
time: 15ms
memory: 153416kb

input:

32 343354057

output:

0 1 313495617 53844526 231252792 128998566 174328751 224091529 138959090 216876142 179748805 338486546 297772823 72545316 248868596 69102890 100071585 170273050 275182012 257366986 146860831 218480045 319773419 116609402 166320727 57356042 235421098 66046800 303003010 14424855 251041175 223833601 
0...

result:

ok 1024 numbers

Test #27:

score: 15
Accepted
time: 13ms
memory: 149432kb

input:

31 777989287

output:

0 1 617145319 344494266 537537508 310008206 764250168 336711723 665317518 369953200 129030278 233169491 181652171 13810773 329554939 601147436 424218139 108853969 690329568 408501197 618860772 155170315 204442617 505304158 399261905 756675512 390527796 350536613 479848645 734562063 558082567 
0 0 1 ...

result:

ok 961 numbers

Test #28:

score: 15
Accepted
time: 11ms
memory: 145252kb

input:

30 625674299

output:

0 1 322847385 226756195 361363773 108510873 567786811 274960123 619134027 75736993 428525083 456951590 458386113 252499045 13271219 139014691 458996015 267125372 230707375 86117057 76018249 470306583 265136062 119348618 441291625 232261364 594752556 242529223 520184148 144050647 
0 0 1 276536607 122...

result:

ok 900 numbers

Test #29:

score: 15
Accepted
time: 3ms
memory: 139088kb

input:

29 517323109

output:

0 1 305623856 192862397 493212741 367368961 206858562 209356669 15815177 49445793 441673297 448194356 430205303 479295975 57516658 52761019 296802503 370710488 26987091 201025200 132470980 109542125 235290200 423765649 290157514 486040782 88877017 47914397 197024358 
0 0 1 136834593 208385649 392784...

result:

ok 841 numbers

Test #30:

score: 15
Accepted
time: 12ms
memory: 135056kb

input:

28 675877603

output:

0 1 121320378 412110920 579253090 450655308 664410311 380786364 344701457 480369197 56796317 215465464 265684382 277588613 207384898 263899563 466002600 19222025 350173665 289242160 472459704 669477494 556580035 224156581 501539770 515050946 48234862 531991644 
0 0 1 460184095 419114005 541309907 30...

result:

ok 784 numbers

Subtask #5:

score: 5
Accepted

Dependency #4:

100%
Accepted

Test #31:

score: 5
Accepted
time: 16ms
memory: 157600kb

input:

33 912833539

output:

0 1 336460201 89787143 519926149 759055713 500719750 1448710 273368302 628977164 581172641 638214383 171597605 299479112 36926728 319135039 590267839 677022578 307381724 879003355 547766898 54505021 381980145 422595468 349866597 651448522 808427003 56276086 442641467 609728829 481685693 721724448 59...

result:

ok 1089 numbers

Test #32:

score: 5
Accepted
time: 16ms
memory: 159768kb

input:

33 259085597

output:

0 1 143228704 258150541 107680286 232381072 228071640 41273452 15631681 158428409 140142968 185274466 69057621 6211233 159530152 250865398 150762271 127255042 78023509 253094186 71087579 239208168 242642044 245907870 130426575 206502465 188331033 258147311 151613974 149589244 46946206 189346639 2319...

result:

ok 1089 numbers

Test #33:

score: 5
Accepted
time: 7ms
memory: 159728kb

input:

33 636806579

output:

0 1 420623428 351979150 181156096 20032527 117453020 14952612 76182710 567364025 543497350 131271011 16266422 474221015 522233408 224513654 185093439 19913230 499472493 255051968 399865255 352365892 429608756 591545529 277387214 125467722 605807825 401425477 120563109 68991110 205887245 387798750 22...

result:

ok 1089 numbers

Test #34:

score: 5
Accepted
time: 33ms
memory: 182172kb

input:

38 681163097

output:

0 1 84925172 379141920 601750654 142669949 9650091 174158039 528208716 491545957 174629930 36223492 64890544 73999276 31065402 434924569 579149492 103598617 582257219 265751745 518385128 111020149 169442048 651293355 243588959 507301037 149649318 407946765 430707467 630368708 266973681 77423912 2354...

result:

ok 1444 numbers

Test #35:

score: 5
Accepted
time: 40ms
memory: 188308kb

input:

40 395652529

output:

0 1 178542032 26268261 122568406 179601645 370406080 394713538 308121251 360204816 149878088 348064758 66263441 86346635 252265057 214138192 120505320 155744633 133862261 99389834 337358128 157264669 270215321 306998049 126272966 226621425 351511331 74632139 19735774 342120806 253283066 179104731 13...

result:

ok 1600 numbers

Test #36:

score: 5
Accepted
time: 39ms
memory: 188240kb

input:

40 686144401

output:

0 1 45581726 334161046 420152003 446634050 349973443 444451740 588685978 664064510 306999554 559639335 17150128 185557947 132878431 580958973 219612265 420741444 531685593 185398126 401846333 445302420 188189874 394833394 353699207 629528259 538619415 405503105 569051450 433673783 321857107 40901759...

result:

ok 1600 numbers

Test #37:

score: 5
Accepted
time: 37ms
memory: 184312kb

input:

39 433419137

output:

0 1 41369656 410924975 178899348 50083397 388720872 109340546 91158768 128791227 212918635 78463711 345115727 162463588 72701424 279012694 78298400 103992983 414199621 131108922 236177190 52367797 89535431 58725654 282989927 394204545 269739872 10230785 59603847 192699485 357208642 359824079 4389063...

result:

ok 1521 numbers

Test #38:

score: 5
Accepted
time: 31ms
memory: 180308kb

input:

38 273743143

output:

0 1 24781362 72927091 127618817 111300997 227849658 26207264 96210674 99761181 2338147 133403176 178461918 222251505 113991348 211069857 202882795 241726473 47857444 35922117 926281 109630647 92041349 76938751 21075043 239014922 105036258 214906186 105543856 241636867 94493218 41343382 149193204 189...

result:

ok 1444 numbers

Test #39:

score: 5
Accepted
time: 29ms
memory: 176072kb

input:

37 486774317

output:

0 1 465256676 283479615 64537309 234142025 419018834 190749226 16515401 167408025 11736768 305156202 186158337 155468153 158197516 423013487 33467495 484120049 373102028 480540381 38877534 134204055 430547454 341231673 121552325 187128838 122470086 186767352 107108075 451678953 91895500 103101468 45...

result:

ok 1369 numbers

Test #40:

score: 5
Accepted
time: 27ms
memory: 171936kb

input:

36 123393419

output:

0 1 7534784 16373810 121151679 59009885 75032384 117726512 121512820 121001617 49329471 43243727 52643366 13229059 93033924 16029135 16402689 115348933 13310890 112746311 111367648 73591953 28527011 75392223 73548393 62393032 65939200 42391089 42752669 88941830 50458705 42737410 33862620 16356113 11...

result:

ok 1296 numbers

Subtask #6:

score: 15
Accepted

Dependency #5:

100%
Accepted

Test #41:

score: 15
Accepted
time: 71ms
memory: 219052kb

input:

47 889799149

output:

0 1 66764954 549260808 46596015 84062690 208818053 618084268 357637955 411617511 211048023 291826893 650511151 142754705 22132753 472031385 146691382 637907741 248140067 204739107 382507988 262230303 716148709 740666150 381802244 15607240 167146455 469300300 63509733 688675476 827668333 160583258 77...

result:

ok 2209 numbers

Test #42:

score: 15
Accepted
time: 73ms
memory: 219064kb

input:

47 636406607

output:

0 1 463154690 110460319 395855146 607140406 330598294 20093327 25170871 321286370 340487644 619403857 557370224 187500679 102528451 247218571 168591397 609134613 497997818 163323820 501984282 92905750 152487314 165508947 153067349 170418000 225906176 67108587 150509161 81216147 48648728 545556762 57...

result:

ok 2209 numbers

Test #43:

score: 15
Accepted
time: 58ms
memory: 206716kb

input:

44 801677689

output:

0 1 89264172 505845024 50256172 157294391 627777285 654227127 401530690 5538478 781987028 751218319 792968839 116232760 471128037 229778454 711984335 430280135 286539711 141560081 525289304 238142055 49114773 195565666 48837617 709265933 505562374 661321401 420103668 273319950 139852900 599140909 39...

result:

ok 1936 numbers

Test #44:

score: 15
Accepted
time: 52ms
memory: 204868kb

input:

44 656206483

output:

0 1 103876701 50126461 572675844 571144027 421241799 293880521 96777975 28952087 501042790 128778985 432799655 553437847 354198529 179419109 546365661 101350263 485018813 63468429 313302913 14581276 444383430 96617768 487039842 24634747 223652044 202952194 313946615 174602120 495093525 280866858 307...

result:

ok 1936 numbers

Test #45:

score: 15
Accepted
time: 101ms
memory: 233356kb

input:

50 992635381

output:

0 1 253425855 852768081 809211242 640795870 794423576 345278107 932916220 718059726 809354250 483785167 802678902 611705730 319241644 682095639 109154600 248177886 720821486 429976487 268010062 508430652 350490336 383984170 858853088 862183003 168022920 325894688 302945828 157225371 688449374 276542...

result:

ok 2500 numbers

Test #46:

score: 15
Accepted
time: 102ms
memory: 233232kb

input:

50 245638949

output:

0 1 43454128 171661734 159951809 92765978 212140588 18577128 74695706 143130599 140583008 72098407 58325390 95277752 64464219 7949016 194723367 101079192 196926901 148225464 96855384 183467209 213183997 229566127 74140177 200287678 116065963 236921493 215752723 125947080 125526131 215809705 14371231...

result:

ok 2500 numbers

Test #47:

score: 15
Accepted
time: 95ms
memory: 227320kb

input:

49 932619229

output:

0 1 270142554 674039219 481931252 871552184 160909473 494870787 368557966 398153744 368156694 189079166 699454192 158195104 209150649 893235735 367468073 503533651 203979504 242669038 260979052 126976787 680942898 332982195 836741115 62604673 783161446 680051820 541376420 362803459 183094376 8281855...

result:

ok 2401 numbers

Test #48:

score: 15
Accepted
time: 85ms
memory: 223228kb

input:

48 532121761

output:

0 1 124563019 357831570 56915384 13479062 305709843 97119144 56860372 35542797 405872184 259113536 56057380 424222736 490628774 418992987 410518847 383843102 56795910 317723649 120693751 54988725 309007787 383333758 483207450 441661556 287477630 385638712 111901895 325744714 170461105 242339227 4982...

result:

ok 2304 numbers

Test #49:

score: 15
Accepted
time: 82ms
memory: 219204kb

input:

47 458026537

output:

0 1 419394992 331677464 331772211 129498872 455408027 141498220 243818392 219578751 302529220 193968067 40054632 351620224 109015721 192098726 122096876 114772418 199238949 320862767 408311587 253819695 67037874 293185646 23568693 379566553 267641249 156469307 290197794 339468202 187940167 50152101 ...

result:

ok 2209 numbers

Test #50:

score: 15
Accepted
time: 71ms
memory: 215016kb

input:

46 858912577

output:

0 1 649082933 815755388 709752223 86619112 296858734 1937829 535962726 492377796 288256846 632408863 458134786 306956751 15707064 307709471 292164449 79312996 735109365 104554209 15690763 164115907 163348705 129325307 411476329 55809340 540920814 574863886 79026959 705518535 61390501 281730231 35893...

result:

ok 2116 numbers

Subtask #7:

score: 5
Accepted

Dependency #6:

100%
Accepted

Test #51:

score: 5
Accepted
time: 107ms
memory: 237548kb

input:

51 995655581

output:

0 1 414060562 199320338 307932054 831691576 366227206 409976126 934497945 745027808 909523802 837851807 182467353 963712859 503346294 644525187 340020201 195723887 957497538 680432724 334914139 48034876 122845662 559373139 550253167 777850066 980848183 620965995 263327132 718166553 776904533 7614250...

result:

ok 2601 numbers

Test #52:

score: 5
Accepted
time: 205ms
memory: 266124kb

input:

58 181855907

output:

0 1 175299677 117438219 108095421 12864106 104495350 158819480 122769815 52200454 8567101 44097147 67189077 61208356 26768162 50429861 167303685 130571638 94597012 151665255 2308655 57213059 150245160 82254091 156724959 122500857 138832635 181787385 15657597 11688624 36758610 164102552 114840921 534...

result:

ok 3364 numbers

Test #53:

score: 5
Accepted
time: 171ms
memory: 260072kb

input:

56 941852911

output:

0 1 792665770 163938207 52524916 15333272 590349849 682410069 505564302 163149418 143664287 422787632 631500491 903256371 927933328 617767378 234481336 366974748 629865389 105198986 890915977 61707647 468764274 733889402 236463766 704900320 721985089 617033110 334509605 577275007 825787384 161731720...

result:

ok 3136 numbers

Test #54:

score: 5
Accepted
time: 151ms
memory: 249916kb

input:

54 659446589

output:

0 1 481267696 279452636 182246663 616752674 369154516 527411155 522465774 259226236 171515408 112318810 542030792 577118393 129675101 36531042 587077209 174271245 209682879 179470828 259755637 281855327 627792588 623423808 480586146 109136094 232228684 542628229 581891342 155643983 436846220 3467682...

result:

ok 2916 numbers

Test #55:

score: 5
Accepted
time: 298ms
memory: 288800kb

input:

63 959797933

output:

0 1 245332495 239686359 840245118 77987730 246201590 168267745 127481578 406780622 446267598 850235809 243307040 189784078 717788448 805602900 139592975 484986133 428278275 1693265 588660748 633415939 546283079 260053111 627763361 308852241 506678703 16614041 538442570 469631745 625245325 308971733 ...

result:

ok 3969 numbers

Test #56:

score: 5
Accepted
time: 342ms
memory: 297004kb

input:

65 570076789

output:

0 1 310328804 294980678 365437294 200660137 395421648 61872119 466968891 3522622 327853984 173660946 458028044 297797149 342416231 266195608 320148543 370440828 258981715 364529815 459374107 22440616 246806181 397238936 26360731 433651520 90433318 140566742 38902952 281229233 178500662 558639261 558...

result:

ok 4225 numbers

Test #57:

score: 5
Accepted
time: 323ms
memory: 294824kb

input:

64 775108613

output:

0 1 596356662 171755335 552094446 773859240 134034335 717362522 52556356 271885992 447988787 532175727 458640228 344428261 370377530 420472378 113588373 651993051 377963323 588219135 323349803 748499961 25033599 562045058 424377766 378085438 51852840 452409629 738187923 91326374 137830645 705238522 ...

result:

ok 4096 numbers

Test #58:

score: 5
Accepted
time: 305ms
memory: 290588kb

input:

63 137625419

output:

0 1 65829402 7815283 127755639 36136848 6729351 54105084 5302245 22989549 53639024 46247934 29720169 109287150 69048505 89556194 131387755 78835785 64302374 135399915 99523319 15349724 50131487 104543276 24936980 104912940 47875892 30425158 116085976 19545315 14798836 83145508 126017858 56416572 127...

result:

ok 3969 numbers

Test #59:

score: 5
Accepted
time: 280ms
memory: 286536kb

input:

62 195857911

output:

0 1 42695576 69644185 49328469 19075152 42730501 162221338 86559278 125704040 93462371 47249286 173884694 43067149 72455575 5651862 25984716 9901739 47951176 72452733 91643324 68308398 28954711 162996275 4020319 17208725 9652784 76192502 41566299 33108352 84196604 13006840 18647237 63262061 34418109...

result:

ok 3844 numbers

Test #60:

score: 5
Accepted
time: 256ms
memory: 280580kb

input:

61 737824709

output:

0 1 128232813 272390695 508404346 551164364 14208589 726189688 729422941 377136204 679827028 563055906 363993809 703542427 16400884 442577104 55705867 558246093 133172983 596219043 217666646 172542280 223691796 727050929 266640862 733835725 722433065 595052543 388595152 532422815 680497909 127734159...

result:

ok 3721 numbers

Subtask #8:

score: 5
Accepted

Dependency #7:

100%
Accepted

Test #61:

score: 5
Accepted
time: 664ms
memory: 335964kb

input:

74 355734727

output:

0 1 172316249 207802534 184477206 127970960 279876067 11697525 68535000 107994264 207266665 285239522 318228653 40587558 167486589 273539944 169246873 249571178 223045274 47072079 49214711 67626859 258928979 103664286 287141049 252007654 14600543 305774852 121096410 279574795 190136708 268369666 319...

result:

ok 5476 numbers

Test #62:

score: 5
Accepted
time: 576ms
memory: 327868kb

input:

72 581749769

output:

0 1 144680963 558720839 43571909 38039108 517295341 525006844 473377773 427258547 263729717 410969832 9291548 237378604 439546583 153764911 122557553 418292158 542880687 415771543 98870144 308842405 411458385 370775573 418387291 35618784 513613439 223166696 431262473 292396087 35756040 223191733 235...

result:

ok 5184 numbers

Test #63:

score: 5
Accepted
time: 805ms
memory: 350204kb

input:

77 294573973

output:

0 1 116589077 63955156 145963520 152930188 252865372 141858148 16584984 104455818 71034651 274527493 269402484 250442066 188697051 145205741 199019307 256055718 27577479 275129685 86902972 136454745 276450114 258734718 125856527 284953823 15869772 62061707 15150577 172791080 13260200 91399169 183552...

result:

ok 5929 numbers

Test #64:

score: 5
Accepted
time: 460ms
memory: 315308kb

input:

69 444426317

output:

0 1 60540764 26853331 174448677 253263350 118580583 382234243 351241810 223182088 342597712 148100580 396772748 432133219 438313267 18226198 52989507 135166893 213093944 251409007 255394983 173708083 257855330 154831516 123895867 330081859 329946776 428945273 244165554 397903364 377922236 376256723 ...

result:

ok 4761 numbers

Test #65:

score: 5
Accepted
time: 574ms
memory: 329732kb

input:

72 903799861

output:

0 1 815253227 652297127 629750141 699057154 460230533 539958268 305316748 154138699 82235246 365162904 455533401 750557675 901923968 501373571 195987169 397181054 307212030 476508096 658185202 15405434 299370655 702411159 693472360 765615825 219927870 194821983 686388393 726726415 339698054 71997936...

result:

ok 5184 numbers

Test #66:

score: 5
Accepted
time: 962ms
memory: 362560kb

input:

80 1041077413

output:

0 1 376828053 798985234 1011269834 350407992 273926387 253328716 627397776 657900380 74015538 454143309 465084654 541884411 11086685 907741959 929086838 128584434 968218053 42381098 95541063 854905063 129292170 588134168 965827597 628742220 855388538 1026341486 172437349 53527597 960207838 776331810...

result:

ok 6400 numbers

Test #67:

score: 5
Accepted
time: 909ms
memory: 358392kb

input:

79 372523757

output:

0 1 350173130 193857108 205584488 261575310 255547180 107731174 347549048 258322079 144912815 173771063 243391295 174673843 51719983 48817070 223701148 113599172 309809173 206875059 99471166 87571187 18215000 370938080 45793264 328803227 110596387 65668498 75672876 83169639 40065256 59704942 3547533...

result:

ok 6241 numbers

Test #68:

score: 5
Accepted
time: 859ms
memory: 354404kb

input:

78 182742953

output:

0 1 98346030 98187521 164372336 51606791 165079232 61370909 114259881 10818654 154012064 43890399 16877522 84779557 20052768 14551736 49331158 158629250 15745576 98922441 107697951 145504132 99582358 74535134 6045268 174878371 38950503 106499777 158910923 70334372 122223920 8644236 159390688 5770108...

result:

ok 6084 numbers

Test #69:

score: 5
Accepted
time: 805ms
memory: 350252kb

input:

77 544024903

output:

0 1 50561459 384563619 309921631 82179460 543117475 126405371 148719536 157996042 525319950 347579384 296755770 364632249 531771085 271514442 198476423 203000600 355274515 51497751 142590952 14365535 227409408 543137791 331232395 30028514 424096850 473212265 357018304 438668891 204606768 28019602 47...

result:

ok 5929 numbers

Test #70:

score: 5
Accepted
time: 755ms
memory: 346176kb

input:

76 642285169

output:

0 1 624708844 180274792 411231524 411847231 621545399 574203455 45792563 180658965 475936556 516316903 111706536 629949895 483623683 253982311 550598909 249678528 436446616 258511882 373324437 238047938 336637303 17636510 319099717 518670467 333502626 174828834 556389198 369353570 626801810 50556855...

result:

ok 5776 numbers

Subtask #9:

score: 0
Runtime Error

Dependency #8:

100%
Accepted

Test #71:

score: 0
Runtime Error

input:

112 368918587

output:


result:


Subtask #10:

score: 0
Skipped

Dependency #9:

0%