QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#67571#5040. Dirichlet $k$-th rootalpha1022AC ✓38ms3240kbC++231.9kb2022-12-10 17:34:052022-12-10 17:34:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-10 17:34:06]
  • 评测
  • 测评结果:AC
  • 用时:38ms
  • 内存:3240kb
  • [2022-12-10 17:34:05]
  • 提交

answer

#include <cstdio>
#include <cstring>
#define add(x,y) (x + y >= (mod - 1) ? x + y - (mod - 1) : x + y)
#define dec(x,y) (x < y ? x - y + (mod - 1) : x - y)
using namespace std;
const int N = 1e6;
const int mod = 998244353;
inline int fpow(int a,int b)
{
	int ret = 1;
	for(;b;b >>= 1)
		(b & 1) && (ret = (long long)ret * a % mod),a = (long long)a * a % mod;
	return ret;
}
int n,k;
int f[N + 5],g[N + 5];
int vis[N + 5],cnt,prime[N + 5],c[N + 5];
int inv[25];
void ln(int *f,int n)
{
	for(register int i = 1;i <= n;++i)
		g[i] = (long long)f[i] * c[i] % mod;
	for(register int i = 1;i <= n;++i)
	{
		for(register int j = 2;i * j <= n;++j)
			g[i * j] = (g[i * j] - (long long)g[i] * f[j] % mod + mod) % mod;
		i > 1 && (g[i] = (long long)g[i] * inv[c[i]] % mod);
	}
	for(register int i = 1;i <= n;++i)
		f[i] = g[i];
}
void exp(int *f,int n)
{
	memset(g + 1,0,sizeof(int) * n),g[1] = 1;
	for(register int i = 1;i <= n;++i)
		f[i] = (long long)f[i] * c[i] % mod;
	for(register int i = 1;i <= n;++i)
	{
		i > 1 && (g[i] = (long long)g[i] * inv[c[i]] % mod);
		for(register int j = 2;i * j <= n;++j)
			g[i * j] = (g[i * j] + (long long)g[i] * f[j]) % mod;
	}
	for(register int i = 1;i <= n;++i)
		f[i] = g[i];
}
int ans;
int main()
{
	scanf("%d%d",&n,&k),k = fpow(k,mod - 2);
	for(register int i = 2;i <= n;++i)
	{
		if(!vis[i])
			c[prime[++cnt] = i] = 1;
		for(register int j = 1;j <= cnt && i * prime[j] <= n;++j)
		{
			vis[i * prime[j]] = 1,c[i * prime[j]] = c[i] + 1;
			if(!(i % prime[j]))
				break;
		}
		ans = ans < c[i] ? c[i] : ans;
	}
	inv[1] = 1;
	for(register int i = 2;i <= 20;++i)
		inv[i] = (long long)(mod - mod / i) * inv[mod % i] % mod;
	for(register int i = 1;i <= n;++i)
		scanf("%d",f + i);
	ln(f,n);
	for(register int i = 1;i <= n;++i)
		f[i] = (long long)f[i] * k % mod;
	exp(f,n);
	for(register int i = 1;i <= n;++i)
		printf("%d%c",f[i]," \n"[i == n]);
}

详细

Test #1:

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

input:

5 2
1 8 4 26 6

output:

1 4 2 5 3

result:

ok 5 number(s): "1 4 2 5 3"

Test #2:

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

input:

1000 10
1 516238479 765833625 408427111 593035929 984641872 149832309 743527500 533342020 315774476 81082172 461044503 235289865 539969249 564590101 736090497 933661679 394417077 377363949 717587561 143428748 321957671 413061277 166846744 532438287 802900949 101236134 182814904 328306207 83339054 87...

output:

1 750394895 575705539 383612918 758074640 870483127 713754278 172378328 328377975 148157627 607054829 769165678 522651163 979451027 321052733 428161561 792137215 595294435 736507442 784558508 35541967 129771597 141130563 667029666 976562087 614420517 890540347 922620141 132655056 898078185 586990958...

result:

ok 1000 numbers

Test #3:

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

input:

1000 10
1 836321215 611344545 176796302 574251412 137508398 761666720 357050290 801608050 863745155 811911311 829248030 265662561 683320811 920044294 338428495 840771823 558535163 926728514 375903056 522656042 909868778 153190814 812151247 960179729 591861004 169384211 295767075 841728125 81742549 5...

output:

1 582754298 560256631 598696700 656371753 428716095 76166672 762502364 234864311 233488066 380664437 883840099 326039562 115077358 562124625 491468731 982497100 88908472 292321722 938842515 680178128 840510694 214967952 569450139 579949075 97329455 173736151 491492784 583294989 144817858 358079034 9...

result:

ok 1000 numbers

Test #4:

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

input:

1000 10
1 158159598 758845348 641419963 949731479 892599046 605485292 272562963 71629727 807736065 544496098 895461672 992289725 360646418 47025620 104802564 747881967 584699437 779838610 638198320 671654821 729764045 195310235 459211397 159448304 78831175 237532287 408719246 520941761 546171999 897...

output:

1 415113701 475182276 672451493 793744195 950229534 659495141 726381508 631317964 412740072 453747351 272892516 598351149 977147905 739966693 418651375 174612632 596342698 77983861 481155841 428325132 962771540 518653200 864432859 639266798 599162983 114398480 12687680 351567482 742362461 888336134 ...

result:

ok 1000 numbers

Test #5:

score: 0
Accepted
time: 20ms
memory: 3204kb

input:

100000 483386906
1 925386004 817279817 436846237 363754513 36363197 132023702 507929492 314426859 89798592 832041984 299550534 283316534 540665653 105421174 607783420 916340928 533190624 313917727 118229052 732510050 447767998 823833186 132028675 284839462 164439702 201511962 983444172 268467355 346...

output:

1 509298944 768210156 31397754 759101893 80740356 561826331 862564382 840871048 446523741 777685542 905264255 546338384 287746596 545833689 176159038 430279667 722628961 663972399 508456777 441637678 818668691 582753500 541766927 890058957 59127138 430432227 600528851 861723556 273962920 444195967 5...

result:

ok 100000 numbers

Test #6:

score: 0
Accepted
time: 30ms
memory: 3204kb

input:

100000 502307450
1 540668409 119623054 116071836 120600807 346207724 47536376 79941053 862397537 820627732 668027113 27933346 656896610 665891333 404013641 514893564 82214661 386300720 576212991 963482301 854395202 791877303 936919291 27551719 73799517 698613733 616454017 662657808 568860734 5100178...

output:

1 29397587 68079001 227011963 335555431 179610068 564373326 591974259 297462962 671073989 130099298 20602529 499052731 789131971 131177405 68251218 168637126 308935104 761320847 11492624 684312520 192804286 100278257 294091430 806036635 34791937 244136594 61314817 335385399 580637430 387690058 40939...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 31ms
memory: 3108kb

input:

100000 823217882
1 688169212 886236599 793541788 41483173 958042134 193277563 46217199 412123863 855202402 37986287 58306041 334222218 325091057 170387710 422003708 712358703 469639331 536518370 646455126 142072071 833996723 583979442 225064647 861003925 766761809 729406188 479825257 567264230 21738...

output:

1 633236496 764521523 761112605 394195434 436178690 568134997 352779681 464461248 33021710 897762819 395684092 449283588 372540875 74992895 471311278 118599223 436454539 414391537 610483622 263227988 961056409 51203898 159210877 382190391 156399854 506036525 158931210 621767611 510653019 490488149 6...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 37ms
memory: 3200kb

input:

100000 842138426
1 835670016 352615906 702995900 494583936 801860706 503054821 314483229 658104657 285797304 104199929 784933206 11547825 680545250 468980177 329113852 876476789 20759543 798813633 493464022 729983178 343897746 231039592 120587692 347974096 834909885 842358359 461028777 33449327 9230...

output:

1 428618194 64930015 596704138 641390448 755418756 862328911 396473870 526667378 866135366 115123418 521489737 786084895 220187038 764729928 783259994 243165548 453438954 85012193 535294230 663124340 460360352 471715560 24257502 69521429 787301501 791848 34617813 99335367 215602447 191796428 4413502...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 21ms
memory: 3240kb

input:

100000 466794394
1 983170819 351213612 382221499 947684700 809715349 950785893 582749259 207830982 18382090 472403456 815305902 851153856 805770929 235354246 236223996 206386593 406088037 457129128 176436846 851868329 84027283 180089626 318100620 136934151 765104149 791274459 140242413 31852823 6303...

output:

1 461433575 560316619 64528383 482834448 728114145 254641720 764268297 392384526 480680495 366157369 481899172 276736180 811255414 109631574 859595296 302962338 885439049 882547077 372066189 345753111 954883634 697202605 101569302 740815176 859020253 420971229 547911091 569037878 4727610 324181964 7...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 13ms
memory: 3128kb

input:

100000 485714939
1 132427270 119582804 757701567 566577181 423305407 262318798 851015289 755801661 52956761 840606982 707724784 528479464 859235239 835936597 143334140 68514796 955452602 719424391 555664140 441535083 126146704 989430201 745842062 458112604 833252225 904226630 955654215 496282273 639...

output:

1 31183126 363172641 369346745 842179869 755437335 879003898 295426643 189780048 286636971 522853004 283238655 832396290 79705440 411347955 557367672 916410683 361952389 637903011 93982438 536110662 605968971 203135703 632652761 113697112 491304243 664310025 367625074 714664477 976680044 283085677 3...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 30ms
memory: 3184kb

input:

100000 806625371
1 581917957 420170393 436927165 323423476 267123979 874085940 121036966 3538102 481796016 210566156 738097480 205805071 984460918 300320782 280672798 698658837 342536744 981719654 704662920 727456305 634292079 636490351 943354990 641337244 901400301 18934449 936857735 796675652 3470...

output:

1 946406431 465204983 900099364 19060034 448648768 771369562 455003321 865072216 231643866 657087140 622028182 319482133 106499328 600926318 440922254 841018450 863827548 801933432 428248468 780347819 128224082 360918629 370586486 225756259 109848476 453874662 683886264 407173757 321673954 287652884...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 28ms
memory: 3216kb

input:

100000 825545915
1 197200362 884794054 116152764 244305842 576968505 21582775 921521394 249518897 214380802 578769683 466480292 881375031 341670758 368684735 187782943 330558526 195646840 942025033 387635745 849341457 676411500 283550501 838878034 430297299 437329979 433876504 616071371 959115219 54...

output:

1 830654973 609877413 965729392 36037200 585827656 616607929 102255783 730671232 574383538 858096621 37793650 791262775 486740415 243179537 729043280 474844635 264467363 39063869 920371256 220707456 529178817 59473721 398475798 725020916 166928272 260722056 278753927 595148366 502557142 363853344 82...

result:

ok 100000 numbers

Test #13:

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

input:

100000 1
1 537766921 133390620 340812406 700777822 393339907 813813219 775043690 969153150 568921216 968632969 436848033 515717099 795050941 937512393 938140883 953250978 888790176 949054294 376670196 889773076 631948404 320389585 993483258 592817687 169830609 230045051 808000459 666694223 963387669...

output:

1 537766921 133390620 340812406 700777822 393339907 813813219 775043690 969153150 568921216 968632969 436848033 515717099 795050941 937512393 938140883 953250978 888790176 949054294 376670196 889773076 631948404 320389585 993483258 592817687 169830609 230045051 808000459 666694223 963387669 73009810...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 31ms
memory: 3200kb

input:

100000 1
1 161595188 280891423 641399996 610231934 314222273 125413393 388566479 239174827 814902010 4963286 108797090 940354380 472376548 294722233 540478881 394335167 750918378 336138435 336975575 40527503 221615158 362509005 108325010 488340731 957035017 298193127 224698161 345907859 429572766 73...

output:

1 161595188 280891423 641399996 610231934 314222273 125413393 388566479 239174827 814902010 4963286 108797090 940354380 472376548 294722233 540478881 394335167 750918378 336138435 336975575 40527503 221615158 362509005 108325010 488340731 957035017 298193127 224698161 345907859 429572766 739457452 1...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 33ms
memory: 3172kb

input:

100000 1
1 179688040 428392226 107779304 289457533 767323037 133268036 232317782 507440857 364628336 433802541 175010733 970727075 149702155 419947912 4863066 997699780 80828183 885503000 599270838 721744681 809526264 174399912 753629514 685853659 745995072 832367159 337650332 163075308 125986377 44...

output:

1 179688040 428392226 107779304 289457533 767323037 133268036 232317782 507440857 364628336 433802541 175010733 970727075 149702155 419947912 4863066 997699780 80828183 885503000 599270838 721744681 809526264 174399912 753629514 685853659 745995072 832367159 337650332 163075308 125986377 446826918 3...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 36ms
memory: 3120kb

input:

100000 2
1 735046526 866300308 936249189 359210886 338805532 433066347 804981764 750512701 863129266 935871059 798098463 135725371 436882481 104872951 955818061 492785493 513972718 904785728 991541119 857204342 296612487 14979136 798715619 571578701 109222873 967574413 936192081 784724576 614768723 ...

output:

1 367523263 433150154 950192272 179605443 371830072 715655350 713168284 845686111 333988787 967057706 728399309 566984862 915072283 510513074 161881731 745514923 438787164 452392864 787530399 828561648 213371700 7489568 790380822 973447251 636770943 291512366 446025704 392362288 906359176 704294713 ...

result:

ok 100000 numbers

Test #17:

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

input:

100000 3
1 236071662 765001715 763670132 483669905 888250925 656299243 670883768 531872251 927108802 68900867 929120379 984206510 308942535 802696260 139286958 32320007 907171100 328298763 306177805 522645724 355541154 405823156 603947980 780568228 48615138 706859422 598357749 42464388 798368176 905...

output:

1 78690554 920496807 189609859 826719537 764778050 551514532 957560958 610669888 864401087 688463191 553297100 993565072 378301308 539578123 65336024 676269571 319915667 109432921 339945529 624662619 460208423 468022503 987491819 772362289 629311469 75198335 839473629 14154796 739495420 30197348 989...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 27ms
memory: 3232kb

input:

100000 4
1 433351266 965693006 360862561 444092854 439451965 275552370 4567374 845450199 991088339 732393427 292126456 604214783 252763959 968301171 156964137 570098875 135244 284030197 153032889 188087106 414469822 796667177 711170225 989557756 684261871 446144431 654788001 160494741 449749230 7690...

output:

1 607459993 740545428 866202240 610145390 815905107 568010269 876157534 18304865 902751793 432659445 854827999 400614784 199600613 468735688 689543287 392085807 515500268 819690814 737499288 414043533 904154837 947850059 795416095 66620242 159473865 46931883 138522597 788806950 828903736 940954107 9...

result:

ok 100000 numbers

Test #19:

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

input:

100000 998244352
1 634000561 832029693 245948922 102903975 543044535 696647929 885322237 373403332 662415582 485838982 52925964 650549949 583552351 493370102 917369112 969369106 359680297 234780917 794923044 514516417 298465733 944885980 862690299 624311775 695315986 577534203 246037122 76050967 216...

output:

1 364243792 166214660 324474761 895340378 493078889 301596424 775674495 938075215 942093554 512405371 67674296 347694404 962683638 747822337 374734954 28875247 784408836 763463436 623717620 481577744 615739375 53358373 98645269 88273447 417381919 580798588 553277750 922193386 924697693 257823984 218...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 30ms
memory: 3228kb

input:

100000 998244352
1 954083297 979530497 14318113 84119458 463926900 8248103 32819071 339679478 212141907 218423768 421129490 680922644 260877958 316605897 985733065 876479250 523798383 784145482 58973954 361525313 420350884 987005401 509750449 821824704 484276041 645682279 358989293 753508956 9828805...

output:

1 44161056 18713856 733854339 914124895 739444163 989996250 176308093 988056739 885211425 779820585 822726664 317321709 640146022 635741768 96763867 121765103 305786041 214098871 25331882 79253954 185852134 11238952 612719167 343551029 256675025 899251256 28494949 244735397 268671526 550454517 42969...

result:

ok 100000 numbers

Test #21:

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

input:

100000 998244352
1 275921680 128786947 780931658 459599526 615037780 620082514 644586214 607945508 458122702 949252908 487343133 875331411 936447919 974049975 982335648 783589394 155698072 171229623 19279333 740752607 706272107 727134937 156810600 717347748 273236096 877866426 773931348 268686521 98...

output:

1 722322673 869457406 63476232 538644827 605457598 378161839 594389015 618185110 738400834 48991445 492811318 122912942 714266166 108877502 209247247 214654959 975756000 827014730 235413849 940550911 217357702 271109416 382428247 147482856 151733136 748100424 480352387 729557832 518687086 541095167 ...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 18ms
memory: 3172kb

input:

100000 998244352
1 294014532 578277635 83274895 138825124 69894191 463901086 790327401 876211538 7849027 681837694 855546660 905704107 311783642 797285770 52455248 920928052 17826274 720594189 281574596 423725432 295938860 237035960 802115103 914860676 758450620 644024619 584893635 249890041 7494589...

output:

1 704229821 419966718 964524448 859419229 657495090 534343267 833448748 985555384 872520275 316406659 462509577 92540246 608336269 533183986 631156396 77316301 248363512 277650164 130962706 440710326 473096172 761208393 811310794 202231623 70992463 954522248 487778581 748354312 763276468 833725701 4...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 30ms
memory: 3228kb

input:

100000 998244351
1 436720956 631338403 418527978 746460795 991843495 775404917 553394278 756079852 598436046 518600892 223893932 32297323 245466342 25775307 735655862 431590239 268471800 279049483 482042005 849075035 633801650 252052076 755468054 113332364 525695207 838249194 583871454 352285200 328...

output:

1 779883875 183452975 450328282 125891779 242865220 111419718 490925520 484603760 843577621 738943907 103215630 482973515 963730591 745521891 923476976 283327057 900135264 359597435 592169262 379890710 477711936 872218315 556919917 66742143 674538735 314857060 570850519 822101753 25850758 468157654 ...

result:

ok 100000 numbers

Test #24:

score: 0
Accepted
time: 28ms
memory: 3196kb

input:

100000 998244350
1 239441352 430647112 821335549 622001776 442398102 321943508 989482158 974720302 836446393 853352686 860887855 878315006 767670873 326196351 21724215 892055724 571527887 855536448 865415435 881643769 574872983 393426453 950235693 436561234 586302943 100719832 61415247 700280802 847...

output:

1 918430569 521947198 748787920 458162310 598753708 225433615 670077923 589978581 490881077 381045340 756295906 39976449 712693623 522631965 622150115 700892445 661816011 713065537 935679732 277235498 19924999 867102202 527721526 643134626 627373806 840313044 453632052 764817419 344764700 104857465 ...

result:

ok 100000 numbers

Test #25:

score: 0
Accepted
time: 34ms
memory: 3188kb

input:

100000 998244349
1 106765726 702239345 670042017 725162604 572879632 531826221 636504401 889849053 307681827 308648931 724422570 145734882 408093186 887986058 791899150 878715565 494454324 364429085 117266105 881417927 944754611 342746444 739991947 911338403 965360673 170039844 782854779 17487141 10...

output:

1 472430745 74001252 195146655 816953702 853325453 116604533 961237011 163780612 903749806 671521032 930904636 462688456 452402643 930667852 305950529 29882197 895048422 158453817 981479448 249916052 826375537 912557742 479442247 129262916 599788611 121175593 727223684 245189303 837229690 78627720 3...

result:

ok 100000 numbers

Test #26:

score: 0
Accepted
time: 32ms
memory: 3124kb

input:

100000 499122176
1 268676817 561430126 914426088 995036223 291616375 265554817 221742757 267440431 646504709 762717634 315099301 109103732 393411589 182177446 104946460 12595470 423170906 937028922 974195167 400702922 320178476 2222906 611871746 463490846 77381675 629231663 370172712 25828720 912029...

output:

1 460890719 873628454 719583787 6416260 405771060 467134719 529598210 131498152 112991016 471053438 478132738 780036889 725013554 280312584 817188388 973053413 782969194 122430862 434142848 964557684 877044697 993798541 750959650 667715071 997117197 925600856 469673786 946586913 333998251 81581796 1...

result:

ok 100000 numbers

Test #27:

score: 0
Accepted
time: 27ms
memory: 3216kb

input:

100000 499122177
1 465956421 460131533 209628633 423240774 841061768 488787712 553670716 581018380 710484245 427965840 144131333 727356357 35243129 649772241 818878108 852364221 514379403 360541958 821050251 762398773 681097027 393066926 417104107 140261976 16773940 368516671 498364335 676077470 399...

output:

1 931912842 920263066 58522552 846481548 113293814 977575424 953794936 945084532 296416598 855931680 675884128 456468361 828598076 240418162 384934144 706484089 245922271 721083916 933252869 224487692 246287552 786133852 18888831 48369628 785301953 954297473 974468827 353910587 211200401 277156499 8...

result:

ok 100000 numbers

Test #28:

score: 0
Accepted
time: 36ms
memory: 3204kb

input:

100000 499122178
1 663236026 660822824 37049576 547699793 90272923 108040840 117582836 362377930 472473897 93214046 971407718 347364629 209293067 815377152 304336888 89908852 907577784 316273391 437676821 729830039 575989624 783910947 524326352 651241388 954410557 107801680 160530002 97853354 507557...

output:

1 109409233 773296667 360192725 697881313 43246643 737523462 140803092 911141615 429634279 394890815 280229132 564324537 521602794 829833601 314136718 725435470 586228343 543597045 352513222 628199826 153152773 522607298 323843782 455199711 249250906 920604993 933565062 397983687 597003727 10638342 ...

result:

ok 100000 numbers

Test #29:

score: 0
Accepted
time: 37ms
memory: 3192kb

input:

100000 499122175
1 301625726 360738835 318989305 338358806 44160866 344311805 888059152 486080881 50306774 631443472 952093224 955121415 55325580 318562418 921477563 775050839 194008596 981297489 359324244 735261540 261249808 609623238 504649502 950755788 604015366 889946654 313742460 302062952 2624...

output:

1 464412418 92255561 59279176 439923698 868020200 435955032 963751949 360967447 703468833 910030156 442072122 361496743 799941454 756264737 171348764 148795676 225912477 344046027 930688791 221135489 239676864 591828861 498052547 641333193 903964401 231051699 955861240 464120934 424717934 479521482 ...

result:

ok 100000 numbers

Test #30:

score: 0
Accepted
time: 24ms
memory: 3224kb

input:

100000 499122174
1 104346121 928063384 721796876 515889670 492959826 725058677 325902679 868757402 984571591 966195266 124816839 638858673 879519995 849211976 903800385 933526440 102800098 559540100 46443205 767830274 202321140 915033687 167198743 439776376 966612985 848671761 651576792 184032600 78...

output:

1 756857034 826667870 785001046 791888485 955991657 308923141 665488570 522302409 899668319 412117376 476882871 143754272 645483721 751328470 839359762 624833777 208681734 774428313 416766033 635625670 456601948 232933137 681667105 637916785 364367836 320904439 665621531 924631313 1945388 39015724 4...

result:

ok 100000 numbers

Test #31:

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

input:

2 1
1 687795385

output:

1 687795385

result:

ok 2 number(s): "1 687795385"

Test #32:

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

input:

2 10
1 919720388

output:

1 491269780

result:

ok 2 number(s): "1 491269780"

Test #33:

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

input:

2 998244352
1 38901749

output:

1 959342604

result:

ok 2 number(s): "1 959342604"

Test #34:

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

input:

100000 624846234
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...

output:

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 0 0 0 ...

result:

ok 100000 numbers

Test #35:

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

input:

100000 406235397
1 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10...

output:

1 693359877 693359877 265687250 693359877 836258976 693359877 530330913 265687250 836258976 693359877 61373886 693359877 836258976 836258976 75104530 693359877 61373886 693359877 61373886 836258976 836258976 693359877 705914087 265687250 836258976 530330913 61373886 693359877 284733149 693359877 557...

result:

ok 100000 numbers

Test #36:

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

input:

100000 406235397
1 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 998244352 9...

output:

1 829083930 829083930 415527019 829083930 1970108 829083930 929645040 415527019 1970108 829083930 959636729 829083930 1970108 1970108 346058631 829083930 959636729 829083930 959636729 1970108 1970108 829083930 591788110 415527019 1970108 929645040 959636729 829083930 919058997 829083930 170008253 19...

result:

ok 100000 numbers