QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#9729#547. BM 算法RainAir#0 300ms131744kbC++111.8kb2021-04-09 21:19:012021-12-19 11:45:05

Judging History

This is the latest submission verdict.

  • [2024-12-28 21:37:58]
  • hack成功,自动添加数据
  • (/hack/1317)
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2021-12-19 11:45:05]
  • Judged
  • Verdict: 0
  • Time: 300ms
  • Memory: 131744kb
  • [2021-04-09 21:19:01]
  • Submitted

answer

#include <bits/stdc++.h>

#define fi first
#define se second
#define DB double
#define U unsigned
#define P std::pair
#define LL long long
#define LD long double
#define pb emplace_back
#define MP std::make_pair
#define SZ(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 10000+5;
const int ha = 998244353;

inline int qpow(int a,int n=ha-2){
	int res = 1;
	while(n){
		if(n & 1) res = 1ll*res*a%ha;
		a = 1ll*a*a%ha;
		n >>= 1;
	}
	return res;
}

inline void add(int &x,int y){
    x += y-ha;x += x>>31&ha;
}

std::vector<int> R[MAXN];
int fail[MAXN],delta[MAXN],cnt = 0;
int n,a[MAXN];

int main(){
    scanf("%d",&n);FOR(i,1,n) scanf("%d",a+i);
    R[0].clear();
    FOR(i,1,n){
        if(!cnt){
            if(a[i]){
                fail[cnt++] = i;
                delta[i] = a[i];
                R[cnt].resize(i,0);
            }
            continue;
        }
        int sm = 0;delta[i] = a[i];fail[cnt] = i;
        FOR(j,1,SZ(R[cnt])) add(sm,1ll*a[i-j]*R[cnt][j-1]%ha);
        add(delta[i],ha-sm);
        if(!delta[i]) continue;
        int ps = cnt-1;
        FOR(j,0,cnt-2) if(i-fail[j]+SZ(R[j]) < i-fail[ps]+SZ(R[ps])) ps = j;
        int tmp = 1ll*delta[i]*qpow(delta[fail[ps]])%ha;
        R[cnt+1] = R[cnt];
        while(SZ(R[cnt+1]) < i-fail[ps]+SZ(R[ps])) R[cnt+1].pb(0);
        add(R[cnt+1][i-fail[ps]-1],tmp);
        FOR(j,0,SZ(R[ps])-1) add(R[cnt+1][i-fail[ps]+j],ha-1ll*R[ps][j]*tmp%ha);
        ++cnt;
    }
    while(!R[cnt].empty() && !R[cnt].back()) R[cnt].pop_back();
    for(auto x:R[cnt]) printf("%d ",x);puts("");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 105ms
memory: 46572kb

input:

10000
481761257 325845401 89198273 331256176 423285801 510703206 160079009 805700484 2785453 119847482 4456012 47414124 382685410 463638256 314056646 483110670 723760177 473280072 294639899 965560586 243267953 822936984 475063108 193430844 842374415 125382693 569285769 643640101 548245375 253979925 321137422 807590125 439193916 555824578 695790048 768546711 874232025 722632162 70574178 284940598 933002512 489768439 42054935 599527755 335883097 525622561 239852608 810334714 224789879 472795210 34...

output:

519996520 676098795 636816471 494383311 88254187 542188011 442632990 847848618 639292958 22724161 734302549 364991396 926096346 988368003 304154451 342281483 623977164 383132553 297361731 782343399 865656753 547123615 620909076 813317753 466953279 371327965 118623130 665641245 786523122 671100455 65782900 288071510 640713298 592449454 652553430 225918851 347757336 583393787 102182470 680400374 21179883 5940009 849882906 494527024 338360869 986094824 28876099 167617935 712458910 669946244 9138140...

result:

wrong answer you didn't minimize k

Test #2:

score: 0
Wrong Answer
time: 254ms
memory: 131680kb

input:

10000
377957992 230735870 772819998 993198239 360968885 378226178 886315386 228008333 144745061 641762685 397935071 922736446 523431856 488694995 883193240 462320640 141474228 444154151 788323626 661135743 226247281 156277129 85788520 625038763 744947170 913201034 172630470 371511206 832939892 774089636 892909135 823778443 738599520 940107259 74577347 85203293 746264596 43800291 249971562 202824758 476017303 627539207 168727202 495311891 642341759 186369849 667383766 611957481 910693056 73550853...

output:

393784191 327611113 746428186 68561236 411757545 696264 109358442 375491239 739219265 726979658 151378012 583573520 223885538 871759378 503101329 236336754 723214666 322758209 396555935 206008246 571674370 246676759 398763599 602969282 962989938 197277305 259328931 511466876 153483063 90104143 908004685 419170748 36137366 66493348 490943069 943494683 950656621 371740680 577395352 880802355 293511741 457842984 22776563 829736732 295707588 80222371 175830271 523160132 36721922 978829521 548866059 ...

result:

wrong answer you didn't minimize k

Test #3:

score: 0
Wrong Answer
time: 268ms
memory: 131724kb

input:

10000
994467050 345579150 368407658 822508970 227318746 113808913 22746242 348704395 883368358 714835147 503065644 194474178 780502268 433260222 638121661 336797014 636132928 846071542 663037324 142402894 445584362 68372299 510178125 203420803 127227056 914670253 593408957 328806860 390758916 513613113 827410390 923521355 995003710 795081686 801634427 490967992 372528296 375167933 970366517 65886467 293885895 636359793 718289182 389823558 141043510 667346672 216236222 921323471 834733430 1393107...

output:

497815007 456892307 537995517 373060155 722783942 942040616 694672938 700332074 329593775 121653589 591311455 958548932 871010143 701007724 404240217 957527324 402771947 901411244 365504958 132915459 544158395 59271791 585026427 779704389 826931701 947652461 448404496 163927230 476411185 961758577 818550160 761785111 205062648 449672314 123984771 68211519 107892134 852725451 537213107 86795710 309551216 370886795 643152226 263101958 320419487 475727009 312437265 796722335 58565946 313822590 5046...

result:

wrong answer you didn't minimize k

Test #4:

score: 0
Wrong Answer
time: 273ms
memory: 131656kb

input:

10000
422321407 874394669 424297648 172859345 273647214 190897162 559947796 449542846 112460126 946375780 984079597 610596519 714558923 347032404 121312306 330426000 149791827 512286657 376940868 713079105 867945071 868579686 620169139 257603123 893494417 452555681 888893820 442451361 47755329 941802786 542023749 142507278 729310251 662742358 932153689 819038977 516565359 899041903 667898540 853352691 984625734 438809741 973471926 965509551 846158116 677947905 322574625 905010866 141984395 50330...

output:

241920122 802421024 923265635 903375090 278912732 462302400 238341102 404910590 471473885 538412797 418213874 264602267 535270781 450928677 96303476 948866605 224019956 417530486 252693026 864114249 527357349 266871358 901882905 887751772 757697280 933853925 656311923 952886930 628553199 669012577 328957179 293068198 260771000 802080799 40303148 142471572 333072272 30131924 168874899 870422538 555975613 507249350 558127058 9931421 76235971 632588869 548648585 551525146 708414529 49465298 3184654...

result:

wrong answer you didn't minimize k

Test #5:

score: 0
Wrong Answer
time: 221ms
memory: 131696kb

input:

10000
284535580 904733529 407516463 760176463 12497548 96996750 326237736 770765595 804123903 917411039 82310503 272960190 933904784 296938585 447657802 84352574 461473873 894856552 567017606 799210461 369489990 708397386 7757883 181367404 605182665 225382946 187583443 395599958 746823867 809189320 327153032 588054644 879238188 651507757 686215659 633748789 487973095 690994032 936971696 61126298 287191454 768482238 301504937 183008920 328030151 597050092 61951354 50900113 490469971 21584230 7728...

output:

966657922 239335368 940745769 945041235 614431578 311989574 941865519 265845586 771655443 881692247 832437485 213199525 915687329 177438804 51468891 342630901 845406988 736086706 84169261 46010212 151342619 770873214 786152246 130807916 420362251 577845535 615103711 759266908 986980701 713058548 444353057 662778618 551793314 981835163 124495800 627437935 674763156 57217673 947300043 575080119 860194492 497254092 914789561 284034220 381855200 121652968 174389199 972289540 931040638 646048077 3121...

result:

wrong answer you didn't minimize k

Test #6:

score: 0
Wrong Answer
time: 270ms
memory: 131648kb

input:

10000
143402562 710493128 887681468 532235816 11250361 343965675 646233797 181000080 666275055 946724519 145129714 10485344 98155157 537369885 832915199 98115788 710792633 109334564 1763953 506332992 872077306 162316709 677083289 384734909 405706417 907445544 890927000 402847518 315194042 173085581 492921236 837985923 457623852 817206051 134022434 839540857 393155306 47882810 732036497 77045705 388025130 353691140 25567017 58993560 703393601 901462005 908488688 359466827 654239165 777220133 5414...

output:

636910087 995175793 860437888 296451485 675465101 326861271 41188858 562190693 785737943 275081337 303752210 448164916 961865439 876294614 961732983 716216838 886101133 935101217 407380018 270715323 879110972 961807818 113773537 700437861 216325444 321286709 547997131 105301682 231255973 375545281 138498084 800847162 555841808 767106665 936569064 214888339 36244934 323689399 759827929 621270231 51299024 487044087 609174071 349435070 779330737 112453246 34460598 639864703 588076380 374066398 4048...

result:

wrong answer you didn't minimize k

Test #7:

score: 0
Wrong Answer
time: 300ms
memory: 131676kb

input:

10000
52647847 844512611 280928302 751557005 420466432 861986872 267896994 4240313 817817481 927655515 851858557 870133599 198036189 805740294 140712607 921128264 844983674 978125074 888858650 948450794 687344982 737245781 339660667 541639603 892892906 50615330 216916882 220287793 633969604 252242878 80671901 740662910 5600251 383006687 527290834 124328197 903221094 74281453 903608149 843060512 606893550 704161422 277214014 411999188 608332575 614062772 15108449 328906302 810964884 898408069 527...

output:

751619741 344890769 229779255 454639758 590087669 323280649 567963272 14045010 613455209 236314281 756378327 712734467 387043710 338659182 203691097 850808127 87783396 962277655 378393661 366506619 898439404 829341680 776067662 982211573 370033926 825506235 239870914 570126260 270908525 710886502 465891805 274127318 648373522 464431182 550980501 870694323 463487529 507447909 977357900 165613174 99001020 776103915 626459473 301542665 496348716 139232610 348375007 970572158 367931047 791126104 488...

result:

wrong answer you didn't minimize k

Test #8:

score: 0
Wrong Answer
time: 284ms
memory: 131732kb

input:

10000
487583046 344693028 826880083 929392262 867951520 408064391 400765869 73124285 895519401 1134312 626909117 156750276 216501935 876445227 142304635 290995429 372199598 28663296 402137325 927614574 350671865 210948669 825856676 215108238 134526265 197222945 164795341 196100988 468597412 566453293 490377012 209795322 858515618 587275566 317659491 413804329 429078204 922871210 299586381 30597051 915577123 184301950 962406897 788403457 598350678 418184586 447860331 248804953 492851830 140854215...

output:

921922220 907940567 526496331 407453653 809314083 900902720 391465628 266825837 197510623 178204259 428276627 894383054 149541178 85654965 617062416 694491344 120801645 918478699 730185311 859573750 247121963 639402061 659183953 213565941 222898842 940237475 405568299 677562997 252027146 352505105 201768490 846620457 190213864 140212599 214928586 876283854 16321920 400407596 374221547 681343406 465879554 924083779 232493622 465060998 203145721 765328798 483679362 60266956 347326369 208801896 314...

result:

wrong answer you didn't minimize k

Test #9:

score: 0
Wrong Answer
time: 275ms
memory: 131612kb

input:

10000
522870486 728596067 342867687 773337741 995805742 913938215 693740993 719822271 646825737 560772154 902322257 186022837 683085684 810001222 351663644 301237456 965053493 776973140 453390057 342680011 159514296 171302654 909396470 78871368 576640309 310207930 237909277 559788088 536043927 772346209 180750482 684092163 386867317 271698289 150104595 984522691 361571164 539864592 423941221 373478433 866164603 361103790 885090329 257602452 464102311 948167272 633421166 777212175 45871875 366159...

output:

274802113 721640048 590567185 663601729 29955799 221775361 493151209 59158244 219522501 12828176 328778131 717606763 800793013 612913217 272375765 301199434 337496124 274536840 912645929 442922099 350787659 255740307 295480436 700972743 685584839 586936655 186667536 777509516 30324215 491984949 463330292 681532620 937150360 453655190 94085281 134423966 510032926 544011098 314551646 123150068 609308197 300635614 473489953 210118575 526535453 512341857 649014152 172553108 110429175 156212328 38392...

result:

wrong answer you didn't minimize k

Test #10:

score: 0
Wrong Answer
time: 259ms
memory: 131656kb

input:

10000
957725520 854846291 969491053 356250398 691705616 213195336 580768790 67132468 874683049 587263928 159905787 591245052 44365380 800142401 225588361 208452961 739469465 130683730 284272807 107327163 183355931 936856467 6990073 292261808 892473264 530135765 586566900 505038785 964987342 629588720 498998636 60420455 479770532 210220226 568202875 173749381 532108012 523361856 556638190 765143957 454192091 252876266 275113383 951761418 57488739 904828258 550297976 32094906 216285909 377075129 6...

output:

936422497 547236824 341406214 369258274 484725247 972517217 181146487 910209592 456507746 267678502 41616376 160273347 419188724 933646550 667327536 341847329 931087231 290299432 934826830 431390305 433294654 893889005 455503084 857782557 200292540 937545096 40119328 203327821 100447808 725453248 439966173 448125439 360897539 211593778 326683647 128558610 358640927 30064380 784891973 542457996 768222105 846604355 895058039 584971111 646292972 959995283 863738488 799919257 432009752 34853787 9257...

result:

wrong answer you didn't minimize k

Test #11:

score: 0
Wrong Answer
time: 246ms
memory: 131652kb

input:

10000
468567402 615227461 825790121 924536374 466843001 364872472 35783838 961206768 601425855 669469693 62533267 931605325 103463216 694776506 491182366 643726023 831922439 24457246 734138378 688617551 395538864 825956960 628023036 153322223 40900393 729283507 371038750 903379206 201996039 149486783 53069197 738339562 256111516 965763417 346356310 74045911 567299344 570963600 865091129 978925519 298313396 780074522 357673663 367927945 815706943 251710524 886455569 273643032 354783112 731095410 ...

output:

176737565 161081663 671601904 990035167 336342077 215279973 542545314 430344662 988843213 667237563 55942639 830068892 135667082 860076600 568449487 589641911 411357767 412294494 472204428 378696549 921720714 775438839 7666416 805057129 775100797 243577325 271813539 66555713 24980583 427937651 456952785 548136769 875879955 885627805 645013618 865933135 268358024 353684740 377744160 744999229 992081833 361647506 544260561 688055467 850490178 164600761 854638853 218473659 27554161 710134479 184124...

result:

wrong answer you didn't minimize k

Test #12:

score: 0
Wrong Answer
time: 273ms
memory: 131672kb

input:

10000
69862984 293611926 403004942 463746003 659628869 670460967 974517991 836756407 872315054 303957729 818948017 132026024 608732344 851995441 921247689 300940657 282980343 533588021 231159141 115601907 161346426 965077118 434900526 804152885 533402643 800086212 897870234 659037755 680872901 652253708 696579317 272664795 601017450 380042003 358927654 885372241 762611204 559298954 606719395 20550007 878254488 465385966 293317564 978079060 255528868 723646688 819561229 751578678 284152591 219815...

output:

822982633 916462835 946431456 289298678 740903269 825608691 712437716 477886717 267612008 25532735 399515671 685320521 249164778 236332095 793052999 714890750 328292696 457830762 548947455 942276699 880397529 356861656 414511580 505301182 731831813 453848666 202680506 836744452 151626484 22489765 789011838 517980116 175027165 713266676 924459471 455230441 942066757 761520606 460663088 856971607 634971210 132472330 369398208 585619560 923163614 843871613 668886381 52697062 98680901 314435898 6940...

result:

wrong answer you didn't minimize k

Test #13:

score: 0
Wrong Answer
time: 254ms
memory: 131636kb

input:

10000
302610832 195739555 615926253 945276664 433921214 311571850 628494857 599350354 254090811 942941793 189235408 988101968 858805828 827202076 722754803 149002706 299639408 232447563 578318640 74552395 281140007 322226109 905781990 803107348 319318654 214252035 766487192 661593943 700418938 307267978 179099212 848259548 178201573 605562279 823638265 664902340 328764672 151257732 324315399 28528039 355445523 37036717 393161332 28497604 518268512 583724281 120930378 635671858 380746968 89476091...

output:

38710211 433371254 770617667 894622533 506999622 75120448 562087008 673731892 209616835 617734077 439986020 986917643 606256566 877592192 761977015 345533913 616989089 885801084 694114705 310212542 844414415 394906882 997618196 280338788 406061873 723672163 649961464 559092718 751533765 471470630 346240838 127682164 955042892 810462870 656120250 782314525 273446843 738134653 46842547 65858934 776612993 321489790 775846967 782517818 467894178 104091712 933118815 141511118 799145013 765031309 5839...

result:

wrong answer you didn't minimize k

Test #14:

score: 0
Wrong Answer
time: 262ms
memory: 131636kb

input:

10000
194896228 365691994 70573349 52066983 251370641 592635286 802370214 371278914 534032008 470173258 818664030 633926171 148741371 375736605 776542446 937276745 742949876 77010768 900860596 707193546 862212465 211006831 177123515 903854249 413455739 375289098 531661615 604267091 797158809 890908982 45472935 716606604 55238337 99962855 427685741 60701548 100658386 336051316 993314919 435559954 985485921 21455570 972740541 899099391 777255902 643342788 826229428 292483091 729001423 137196113 22...

output:

812822712 586483437 833582293 577080516 298821734 311325820 479709382 782299002 639366996 225719979 147311531 662755215 223354168 153552690 567691264 172872587 121495514 819241620 929153708 656330183 455494083 357201197 115773893 610629481 208052811 120870683 924536328 779744326 705348341 710362626 460199597 693834252 707626983 629504293 247058284 162068927 509471992 830003911 560468919 793727165 601759829 725729647 413960836 334477984 407517900 207726481 536364569 855551776 116240092 842354616 ...

result:

wrong answer you didn't minimize k

Test #15:

score: 0
Wrong Answer
time: 259ms
memory: 131652kb

input:

10000
173682722 823239462 497261788 898490895 314555842 291743840 613638047 537082136 503296908 440934740 696542803 824708774 566603947 485620288 300818184 921570494 375405522 250256317 338078768 267431337 658768476 575964387 951479366 104388069 431325614 792083015 145946469 191033122 507972995 886029372 532751171 172869243 793574054 364371334 120843486 275039951 273382809 641601468 757601815 872222212 73071379 22740240 773794092 702526984 885736429 45767417 40595042 901913552 325624892 14093873...

output:

622983105 419961048 779189825 998042003 511383687 353285962 10945139 208097340 356523902 334244213 266071237 573537795 365466769 109830176 552887412 812278625 379749717 88754069 496373264 704448312 576498342 795802304 23148550 474550776 685383793 201002379 4800191 941967405 258206110 360837778 648904244 100166482 995643845 694457376 698638931 414105459 951316322 781363837 259490155 192360932 622667273 845447565 438639246 29375426 130827136 602885873 896332641 131225465 135891404 831163995 253929...

result:

wrong answer you didn't minimize k

Test #16:

score: 0
Wrong Answer
time: 276ms
memory: 131744kb

input:

10000
180872957 339943670 923666064 417992982 339533575 775349576 329510000 145625425 573569765 211500590 566445810 792794434 591183709 175028313 71864328 205913803 412983706 877885019 215279970 819322422 506671586 833345512 699039480 622660968 476099555 475758623 612686236 856117219 759055458 1586656 707125046 4277640 954636217 252013646 313676451 790768650 55477398 542806867 43842310 621107240 572601125 543919804 957149458 430289742 75281751 924597531 722842566 972760498 259813509 298051202 51...

output:

178629068 735788081 177730217 472379685 664570124 110302672 772226376 133124469 207588430 516476180 138551161 49985805 186098800 962938773 251452181 769082008 903412717 566142900 2142661 717153244 804915602 862184302 464123997 260798371 630412471 767911856 512399332 720232019 773929692 421427389 397851476 243778822 281481342 656351556 830194644 310213341 421409547 616959507 372477884 751982274 217081305 257786117 247507552 340208924 803758103 330510175 517536474 3021122 317295395 680769816 85993...

result:

wrong answer you didn't minimize k

Test #17:

score: 0
Wrong Answer
time: 272ms
memory: 131708kb

input:

10000
291189140 310412941 109147063 234599709 330358548 245178015 187231724 118497705 670984353 875636623 681806958 827074754 646536850 515308282 940260328 708983658 355335611 996527156 803147102 65525572 498477971 694445854 673857882 352662978 215416891 937755117 586731991 970486963 116242599 805917235 741113156 460740787 941948067 599555209 513205084 690037147 439330191 104534389 735577626 220492154 215797221 890767530 978465174 188082073 490156347 714845837 194907291 834103363 560948552 66195...

output:

868146164 270404693 792626689 364330603 990918141 378549134 531452817 169265903 494698318 864843694 921665300 413410149 560041300 718655252 803384773 975257727 922952249 255241619 485304729 792609465 575934316 697173349 629681973 146249915 993599803 629220147 944711988 261474593 732632786 735093410 305522537 865031885 890310741 857487693 117676608 556800506 979783678 257853045 748005564 408414878 886314166 21052576 861721754 510510440 453788595 63110898 186085651 52854931 37857238 125467202 7058...

result:

wrong answer you didn't minimize k

Test #18:

score: 0
Wrong Answer
time: 290ms
memory: 131704kb

input:

10000
99628167 17871381 477754729 823487682 163833037 443497093 877969926 901793571 265264653 557880451 253335762 503940775 965234905 635123159 841382197 666022146 667190979 864511439 625446884 729504121 579523530 534312522 204572066 747448465 88325700 392039741 342065376 128926252 143283083 952454094 515368570 436496086 903277902 588084238 439375407 688488862 396155240 909603502 286511947 973201205 524158466 586721448 828849928 638262500 222216444 325187310 395288117 468102961 438997029 4506937...

output:

58819749 60069029 826178095 837675996 480864832 839386077 594112829 248668071 124419413 182598368 181808200 585764038 310130534 371417338 214312854 917056859 554170735 781181333 251347899 715978057 801862002 808390433 861114329 455984888 87557345 284033592 368184357 720080608 786750917 231308772 535213045 755884447 120699407 938831348 39355320 319898621 171617079 290211064 575892719 963979962 884408165 237211028 169234448 835492584 562889743 551657561 485074955 484232163 936225152 726571718 8778...

result:

wrong answer you didn't minimize k

Test #19:

score: 0
Wrong Answer
time: 258ms
memory: 131692kb

input:

10000
981720654 486851988 423085817 305424429 229274760 911398813 54273722 516498837 168853392 505136195 418929257 769673344 430797694 908076834 651077186 624043582 612492865 137464577 577117295 3077674 246604333 570755320 164513746 949001351 256474379 182695561 9496924 395282535 444743691 724782360 117254905 585129666 630219206 198851268 867031680 779766976 691494901 39027424 379721405 156158191 186420036 492656474 209653017 833245345 641209783 167405248 34235599 700323288 497495958 451093027 3...

output:

458045525 526937577 624551565 483832986 562865960 65811406 503036102 717835721 123682111 751743733 982257394 222271887 283347966 545983586 604125284 627872799 111979985 357460979 995824125 225633372 107672338 452853298 142882156 464619960 232334320 744707203 770656063 375419295 17596287 953183160 989550331 712817042 172375212 520594339 72384571 682126479 197095262 338105321 555326012 795141528 574114846 425710572 738316757 977888753 623140822 950676650 158301151 811365763 844108758 810321885 923...

result:

wrong answer you didn't minimize k

Test #20:

score: 0
Wrong Answer
time: 260ms
memory: 131740kb

input:

10000
915846929 265862453 90423096 243585370 971578883 885628335 460190028 120633820 699582999 765042464 717239292 217866398 939707644 488047543 956758075 673960306 741412460 928085904 638426299 810463610 514252660 540402624 475692835 969861072 574746419 815272205 226039098 180344861 450371329 193908222 73703120 347643885 922857770 403674008 845057476 490032147 116402286 296724696 886055452 581784879 589104832 763955971 180617579 655005496 747129238 478795017 865115664 408790816 140158688 270931...

output:

70431865 188490730 199293690 370493257 624953047 736407269 12756864 319486825 254804393 261209960 874662729 407862807 335048075 565077285 976278322 19696662 92111751 587455216 851510292 56939259 585699551 268866018 582893545 35843616 442627680 814531821 9046956 558533752 333683825 519774911 280252739 818310875 879483475 411544216 932117273 163135601 96172117 267371651 778660511 510107142 469106250 517514054 762548860 543667357 433941494 251549740 991828282 957482182 141382710 389837800 713272611...

result:

wrong answer you didn't minimize k