QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#73145#984. HappinesslarryzhongTL 55ms3620kbC++17930b2023-01-22 14:04:232023-01-22 14:04:26

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3488kb

input:

6 3
1 2 4 8 16 32
2 1 4
1 5
2 4 2

output:

189
168
210
252

result:

ok 4 number(s): "189 168 210 252"

Test #2:

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

input:

291 297
690864 66051 879316 361679 613199 616 951868 674311 509731 765530 914257 643036 149469 265479 385645 752029 360309 48606 545052 618893 70334 418974 673141 754792 299130 398298 719505 772883 898465 697947 205006 95537 798625 696927 962164 140276 704224 146457 73196 100864 371302 485115 950286...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 298 numbers

Test #3:

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

input:

295 295
552765 106849 337718 329913 575893 164618 897059 355495 919669 763217 652119 598602 375615 550063 362338 802065 404469 248822 475588 743741 236314 886569 896687 949368 736118 824720 290749 488403 70211 243198 671570 94895 649763 349076 476023 628472 417057 350655 342355 826342 147267 922532 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 296 numbers

Test #4:

score: 0
Accepted
time: 44ms
memory: 3524kb

input:

296 292
197804 718425 56634 403100 978753 617316 121593 944167 884895 801844 613148 623615 822920 116431 372795 179915 790109 774901 961724 265875 718476 818274 593528 45207 199271 233902 751601 242247 11775 88033 912182 946726 998679 382162 791540 990712 283984 188914 36965 121390 716244 896446 236...

output:

712685820
712685820
712685820
712685820
712685820
717318054
716983869
717589993
710256209
706016424
707153891
701271087
724635284
724417845
719673709
704630730
712569827
708723732
703114919
697699010
704624679
702212682
721430608
700393096
702244685
703289901
721707329
727986071
691394429
721590721
...

result:

ok 293 numbers

Test #5:

score: 0
Accepted
time: 46ms
memory: 3544kb

input:

294 291
503603 1295 528959 874005 16784 356063 407396 710552 364457 854105 81255 277227 337622 924237 786842 937442 324199 347508 759112 474964 795014 41077 989187 995407 337551 790107 640382 634943 493635 300299 850365 259818 324049 363697 636774 727713 680955 275129 475482 233431 36465 715331 5493...

output:

243211064
243211064
243211064
241304462
246487749
244149180
242849351
243729937
242981876
240473501
241289144
239589122
242722412
243440252
240166011
244646621
239804677
244016243
246138296
246359596
244043738
245210022
244984337
243219614
242919477
249046022
239542717
237287596
243926344
240551676
...

result:

ok 292 numbers

Test #6:

score: 0
Accepted
time: 46ms
memory: 3560kb

input:

290 295
634846 383682 38882 644797 112952 89231 370780 569445 45432 884805 995805 720763 851778 285921 170815 784518 955568 544322 4855 150378 799076 255752 760947 318089 774545 687763 86803 83267 675405 875841 577183 235032 795668 213958 200001 669641 703427 879349 974729 166286 705661 99867 768052...

output:

661217387
662720782
664133599
667055435
657358941
651597268
657027416
667545462
669288496
673748254
666644307
663744430
656531174
653988862
653971836
654448278
656922978
658083597
652087448
651320779
643062959
643110255
648191618
649160297
649025433
645422902
646683457
641868826
648343369
675058634
...

result:

ok 296 numbers

Test #7:

score: 0
Accepted
time: 48ms
memory: 3620kb

input:

296 299
576338 488913 542853 19862 318192 797562 789873 768709 471762 942794 340062 306502 602999 92722 873773 803924 629926 746752 630109 673400 285755 264681 739304 753534 725126 412467 42700 679018 472050 415678 782065 998053 524534 670135 4509 634161 251237 317905 241361 809368 103497 453789 551...

output:

546525987
548661825
550242498
552059588
549748106
551415281
548838169
548828143
543338259
542314650
541329112
536944262
537750574
538633714
535613227
531320381
530327955
529830727
528071082
526052276
529587817
522829507
522380369
523175114
523338147
518718284
520653264
522763096
515176718
517589791
...

result:

ok 300 numbers

Test #8:

score: 0
Accepted
time: 47ms
memory: 3620kb

input:

290 298
151200 308307 900299 878140 223630 304554 269381 668041 60602 812740 766872 602070 222004 180951 834538 488511 129084 736264 166993 606493 145061 189042 712088 609067 158544 950103 957775 440199 679482 15931 180678 699695 531055 226971 631904 290559 144208 135884 30014 642873 465203 694973 5...

output:

893351222
895575721
893047662
895517900
892249060
893309964
895692688
896052372
894004390
895205404
895535502
892972727
892584945
892506117
895929901
891956833
890661249
892744200
889295979
888679699
889008094
884827111
885668384
890467434
892747934
896147236
896667140
894980669
897000912
894129337
...

result:

ok 299 numbers

Test #9:

score: 0
Accepted
time: 50ms
memory: 3544kb

input:

296 298
425281 421489 461896 866489 536895 67961 72400 379755 625272 468574 822933 179873 855224 810597 102758 305742 869092 739997 402170 717754 585255 482055 277570 992051 688845 259461 789058 288320 987711 626161 319504 212094 26601 394072 696898 660687 844239 656280 223631 20777 389037 904384 18...

output:

263487777
262600013
272182443
276559065
271341904
273605796
279384006
278653078
270815654
272650989
280729803
280282905
282779644
292309794
293991227
295060256
285788655
284328919
249355690
247359878
247687195
286643787
276079031
273067081
273406277
265470938
285860917
275266405
277391440
271310660
...

result:

ok 299 numbers

Test #10:

score: 0
Accepted
time: 51ms
memory: 3504kb

input:

294 294
499344 613463 108432 253232 87241 321758 353501 431564 457147 677802 499260 641105 802301 552240 182592 56884 285407 964992 188688 827027 946475 163913 961690 913830 118193 701604 846246 83865 927069 813398 823361 458494 646628 649547 904552 40435 714332 588582 976811 566510 694806 404161 98...

output:

442254931
441444783
439780351
436137202
438701542
439049415
449382366
445009322
450669286
446603717
441837184
444178344
440481413
437966802
432528147
431514855
433047909
432988889
433088279
436782416
435752755
442506853
447059790
444930641
439523512
439676301
436460229
437876893
432278319
432212815
...

result:

ok 295 numbers

Test #11:

score: 0
Accepted
time: 50ms
memory: 3548kb

input:

300 293
176941 206958 800930 287691 315331 101605 771110 653884 595905 521021 566074 833285 185348 797081 27113 55232 155239 478879 786683 459848 375013 791591 836072 775374 443569 61956 397251 185997 531359 366812 430405 553512 968729 835358 19742 233562 487112 737151 589133 757106 75237 115225 636...

output:

345276637
343152604
342183550
341560095
347692889
343075451
347239383
348493607
339334204
338845322
339313723
336219886
337421843
347492342
348516254
349909347
351225867
341952444
346099043
346499456
351257635
351617801
360737036
357881558
363889484
358359972
361662538
349669834
355645347
354566130
...

result:

ok 294 numbers

Test #12:

score: 0
Accepted
time: 0ms
memory: 3464kb

input:

2 296
491672 128320
1 1
2 1 1
1 1
1 1
2 0 1
2 1 1
2 1 1
2 0 1
2 0 1
2 1 1
2 1 1
1 1
1 1
1 1
2 0 1
2 1 1
1 1
1 1
1 1
2 0 1
1 1
1 1
2 1 1
1 1
2 0 1
2 1 1
1 1
2 0 1
2 0 1
1 1
1 1
2 1 1
1 1
1 1
2 1 1
1 1
1 1
1 1
1 1
2 1 1
2 0 1
1 1
1 1
2 0 1
1 1
2 0 1
2 1 1
1 1
1 1
1 1
1 1
2 1 1
2 0 1
2 0 1
2 1 1
1 1
2 ...

output:

619992
619992
256640
983344
256640
619992
983344
619992
256640
619992
983344
619992
619992
619992
619992
256640
619992
619992
619992
619992
983344
256640
983344
619992
619992
256640
619992
619992
983344
619992
619992
619992
256640
983344
256640
619992
619992
619992
619992
619992
256640
619992
619992...

result:

ok 297 numbers

Test #13:

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

input:

293 300
539792 607476 714416 326858 535343 411400 267409 988390 60911 668742 931493 956011 528193 855993 367235 549239 105615 502706 17167 921309 386464 12831 256984 427485 773206 611080 733757 831462 607870 761942 105161 967256 831191 605522 582360 290954 899262 523044 135650 157737 543171 274867 8...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 301 numbers

Test #14:

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

input:

2 299
549355 144658
1 1
1 1
1 1
1 1
2 1 1
1 1
1 1
2 0 1
1 1
1 1
1 1
2 1 1
2 1 1
2 0 1
1 1
1 1
2 0 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 0 1
2 0 1
1 1
1 1
2 1 1
1 1
1 1
2 1 1
1 1
2 1 1
2 0 1
2 0 1
1 1
1 1
2 0 1
1 1
2 1 1
2 0 1
2 0 1
2 0 1
1 1
1 1
1 1
2 1 1
2 1 1
1 1
2 1 1
2 1 1
1 1
1 1
2 1 1
1 1
1 1
2 1 1
...

output:

694013
694013
694013
694013
694013
289316
1098710
289316
694013
694013
694013
694013
1098710
694013
289316
1098710
289316
694013
694013
694013
694013
694013
694013
694013
694013
289316
694013
694013
694013
1098710
289316
1098710
694013
694013
1098710
694013
1098710
289316
1098710
694013
694013
28931...

result:

ok 300 numbers

Test #15:

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

input:

3 291
421433 380426 269925
2 1 1
1 2
2 1 2
1 2
1 2
1 2
1 1
1 2
1 1
2 1 1
1 2
2 0 1
1 1
1 1
2 0 1
1 2
2 0 2
1 1
1 2
2 1 2
1 2
2 1 2
1 1
2 1 1
1 2
2 1 2
1 1
2 2 1
2 0 1
2 1 1
1 1
1 1
1 2
1 1
2 2 1
2 0 2
2 0 1
2 1 1
2 0 1
1 1
2 1 1
1 2
2 2 2
1 2
1 2
2 1 2
1 1
1 1
2 1 1
2 1 2
1 2
1 2
1 1
2 0 2
2 0 1
2 1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 292 numbers

Test #16:

score: 0
Accepted
time: 49ms
memory: 3548kb

input:

296 291
443573 87168 70509 121283 207008 676413 207870 305388 900593 900207 519086 496912 380909 31375 715795 842545 521180 672912 572143 543823 89521 364773 84775 109262 398052 196913 221486 784609 246527 110072 346720 905264 512272 284114 130199 87990 265837 658150 767614 444366 976325 119461 9876...

output:

408209264
410904069
407783354
407889591
404612719
408222638
408329118
410871095
410553419
410760225
404771330
396583805
410618199
424918180
430830969
433996583
438298445
407981513
405650757
405250781
405059413
406399976
438502154
440402308
399005857
403800858
382250486
423905275
424855948
424045449
...

result:

ok 292 numbers

Test #17:

score: 0
Accepted
time: 44ms
memory: 3540kb

input:

296 294
370806 875916 769238 796332 473968 630635 495988 355719 713496 85351 342821 862256 230081 387167 194363 70269 71058 920136 389543 210820 751418 999083 642329 974428 947727 772601 903349 371476 899951 812237 313814 756252 13190 45438 469838 727029 507273 575501 974326 373310 528619 858477 393...

output:

812154399
812282415
809217594
808896578
812561564
818669736
815154285
807184486
805414722
804180713
808631046
813666601
816241667
815870552
811034805
806778615
815605046
814661152
809366102
809214057
810373552
819886895
809682752
808318793
820071624
813580972
817504349
802780302
804915093
803745051
...

result:

ok 295 numbers

Test #18:

score: 0
Accepted
time: 55ms
memory: 3540kb

input:

292 299
92412 17245 409628 838582 726437 952708 506916 645415 328927 311600 879757 420387 195018 893486 165957 732299 693905 181057 778000 752226 460435 313517 943925 606583 931834 328800 429492 12530 938488 518134 530991 496173 266331 332698 573204 962515 23859 255186 860029 145825 674827 300651 74...

output:

214241547
214241547
214241547
216447784
215312916
220741565
221170566
224715089
226089093
227618210
207443226
208257890
208520470
202466760
201776778
200810181
200562627
208649535
198694636
196398731
200310391
195816489
230483659
199905114
229959911
206785713
202908538
199472988
201962340
202506093
...

result:

ok 300 numbers

Test #19:

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

input:

297 297
325934 894115 731417 648065 379449 469115 617857 109051 609229 384652 492 606074 200806 222598 335262 406449 499634 46389 84951 675088 719359 55388 595776 512672 60540 355 826059 982722 604242 638645 102271 143837 285468 819481 366965 274788 324890 321226 977593 508018 250966 732914 520084 8...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 298 numbers

Test #20:

score: 0
Accepted
time: 41ms
memory: 3548kb

input:

296 295
277227 455802 718916 39599 204339 255491 354412 298847 623780 992147 665348 552924 970956 206045 408262 128221 485846 183409 294463 637497 897503 938678 82310 157570 28634 270780 770260 302173 419875 792079 876185 366927 281771 497867 448061 517198 186664 474844 530682 619723 523645 512167 3...

output:

600776484
603331648
601497101
593239343
607729169
605342728
608478604
601084966
605682457
603187126
603002394
599427868
595889868
592986963
594115767
592126242
599184727
604843450
608416009
608494340
607074355
615658165
601353198
606693561
609964330
595717399
594436850
590115637
589702153
601156084
...

result:

ok 296 numbers

Test #21:

score: 0
Accepted
time: 50ms
memory: 3544kb

input:

292 300
748325 396502 654709 495733 428819 818215 304823 650974 34112 720308 43918 836218 398242 742046 168010 597633 218325 710548 942648 624992 9462 902612 94385 545900 792350 52276 882165 67078 76777 275865 997570 728270 202447 489738 480119 965508 371541 5749 663387 207121 670280 157468 388200 5...

output:

924770955
923310883
925495106
927201764
923830741
924279796
924247712
924908794
924309891
924247712
924903324
925221375
927002822
925299597
924903324
924220043
921595063
924908794
925389024
928085590
927970900
922330725
925062460
924214290
922843082
924983638
921680673
925685545
923169795
923551448
...

result:

ok 301 numbers

Test #22:

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

input:

4999 5000
615912 882074 934067 327162 59021 352357 67254 207841 208595 429172 448781 601247 896943 560595 836640 390651 744738 78717 503551 106977 175201 545393 859962 740149 820609 729713 320319 467517 510550 633637 377636 504995 964236 32314 955208 578205 964014 492864 73612 830746 397921 617693 6...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 5001 numbers

Test #23:

score: -100
Time Limit Exceeded

input:

4990 4993
278417 57614 668216 652861 320183 509539 295777 603032 454196 260568 752864 280596 873924 427787 204545 359260 534407 318875 176613 169071 594799 574779 194348 301661 545573 482422 235733 323062 270634 32922 583619 122913 140975 89625 151508 824644 719486 706609 995155 202598 374305 36105 ...

output:


result: