QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#476809#1427. FlipZhangYiDeRE 152ms98988kbC++142.1kb2024-07-13 21:02:392024-07-13 21:02:40

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 7188kb

input:

2 6
2 1 2
2 1 3
2 1 4
2 2 3
2 2 4
2 3 4

output:

499122177
748683265
748683265
748683265
748683265
499122177

result:

ok 6 numbers

Test #2:

score: 0
Accepted
time: 3ms
memory: 6540kb

input:

3 5
3 2 3 5
2 2 4
2 5 6
3 1 4 6
2 2 5

output:

935854081
623902721
374341633
935854081
686292993

result:

ok 5 number(s): "935854081 623902721 374341633 935854081 686292993"

Test #3:

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

input:

2 1
2 1 2

output:

499122177

result:

ok 1 number(s): "499122177"

Test #4:

score: 0
Accepted
time: 3ms
memory: 7252kb

input:

3 35
2 1 4
2 4 5
3 1 2 4
3 2 3 6
3 3 5 6
3 2 3 4
2 4 6
2 1 2
2 2 6
3 2 5 6
2 2 4
3 3 4 5
3 1 4 5
2 3 4
2 5 6
2 1 6
2 2 5
2 3 6
3 1 2 5
3 1 3 6
3 4 5 6
3 1 3 5
3 2 4 6
2 3 5
3 1 5 6
3 1 3 4
3 3 4 6
3 1 4 6
3 1 2 3
2 1 5
2 1 3
3 2 3 5
3 2 4 5
3 1 2 6
2 2 3

output:

623902721
561512449
873463809
935854081
873463809
873463809
561512449
499122177
686292993
873463809
623902721
935854081
935854081
623902721
374341633
686292993
686292993
686292993
935854081
935854081
748683265
935854081
935854081
686292993
873463809
873463809
935854081
935854081
748683265
686292993
...

result:

ok 35 numbers

Test #5:

score: 0
Accepted
time: 3ms
memory: 6536kb

input:

4 154
3 3 4 6
3 5 6 8
3 2 3 5
3 1 5 7
4 1 2 3 7
3 1 2 8
3 2 4 7
3 1 2 3
2 1 3
3 1 3 8
3 2 5 7
4 1 2 4 6
3 1 3 7
4 1 3 7 8
2 2 7
2 1 8
3 4 7 8
4 1 2 6 7
3 1 3 6
4 1 4 5 8
3 2 4 8
4 2 4 6 8
4 3 4 5 8
2 4 8
4 3 4 5 6
3 2 3 4
4 1 3 5 7
2 1 4
4 1 3 4 7
4 2 3 6 7
3 3 5 6
2 4 7
4 3 4 6 7
2 3 6
4 1 2 7 8
3 ...

output:

873463809
811073537
811073537
904658945
982646785
904658945
904658945
748683265
499122177
904658945
904658945
967049217
904658945
967049217
655097857
655097857
811073537
982646785
873463809
982646785
904658945
982646785
982646785
655097857
967049217
748683265
982646785
499122177
982646785
982646785
...

result:

ok 154 numbers

Test #6:

score: 0
Accepted
time: 3ms
memory: 7400kb

input:

5 627
4 4 6 7 9
5 1 4 5 7 8
4 2 3 6 7
4 2 4 5 7
5 2 6 7 8 10
5 2 4 6 9 10
4 1 2 3 10
3 2 3 9
3 4 6 10
3 1 6 7
3 1 5 9
4 2 3 4 7
3 4 5 6
4 1 2 5 9
3 2 7 8
5 3 4 8 9 10
5 2 3 4 8 9
5 1 2 4 8 10
5 1 2 4 5 6
4 2 6 8 9
5 1 3 4 5 8
4 4 5 7 8
5 3 5 7 8 9
2 5 10
4 2 3 4 5
5 1 6 7 8 10
3 1 3 9
5 1 2 3 4 5
4 ...

output:

970948609
990445569
935854081
935854081
994344961
990445569
970948609
885161985
885161985
826671105
885161985
935854081
779878401
970948609
850067457
982646785
994344961
994344961
967049217
963149825
990445569
959250433
994344961
635600897
873463809
994344961
885161985
935854081
970948609
970948609
...

result:

ok 627 numbers

Test #7:

score: 0
Accepted
time: 3ms
memory: 6944kb

input:

6 2497
4 3 4 7 12
4 1 4 6 11
3 2 5 8
5 3 6 8 10 11
5 1 7 9 10 11
6 1 5 6 8 9 10
3 1 4 9
6 1 5 8 9 11 12
5 3 4 5 9 10
4 3 4 5 7
3 4 11 12
4 1 6 9 11
2 2 7
4 3 5 7 9
5 1 2 4 7 10
6 1 4 5 8 9 12
5 3 8 9 10 11
4 2 5 8 11
5 3 4 5 7 9
4 1 2 4 7
5 2 3 4 5 10
6 2 3 6 10 11 12
5 2 4 6 7 11
6 4 6 8 9 10 12
6 ...

output:

962174977
962174977
795475969
988495873
984596481
996294657
830570497
996294657
986546177
889061377
744783873
958275585
514719745
935854081
986546177
997269505
976797697
962174977
978747393
889061377
986546177
994344961
990445569
997269505
997269505
982646785
986546177
997269505
978747393
997269505
...

result:

ok 2497 numbers

Test #8:

score: 0
Accepted
time: 5ms
memory: 7116kb

input:

7 9893
4 3 6 8 14
2 2 12
6 4 7 9 11 12 13
6 2 4 5 9 12 13
5 7 11 12 13 14
5 1 3 5 9 14
7 3 4 5 7 8 10 14
5 1 3 4 6 13
6 2 5 6 7 9 10
7 1 2 3 4 5 7 12
6 2 5 6 7 12 13
7 2 3 4 8 11 13 14
7 2 3 5 6 7 12 13
5 1 3 4 7 11
7 4 5 6 10 12 13 14
6 3 4 6 8 11 13
6 4 6 7 10 13 14
7 1 5 6 7 9 10 11
4 1 10 12 14
...

output:

955351041
601481217
994588673
995563521
908558337
987033601
998000641
987033601
988495873
997756929
995563521
997756929
998000641
976797697
997269505
996050945
993857537
997269505
915382273
992882689
995563521
994832385
995563521
983621633
847142913
987033601
997756929
995563521
998000641
998000641
...

result:

ok 9893 numbers

Test #9:

score: 0
Accepted
time: 8ms
memory: 6748kb

input:

8 29892
8 2 4 5 6 8 9 13 14
8 1 2 7 8 13 14 15 16
6 4 6 7 8 11 12
7 1 2 5 8 9 11 13
7 4 6 8 10 12 13 15
6 2 5 7 8 9 11
8 1 2 3 5 8 9 12 14
7 1 2 3 9 10 11 13
7 1 2 5 8 11 13 14
5 3 4 7 8 10
8 3 4 5 8 10 13 15 16
8 1 5 8 11 12 13 15 16
6 3 5 6 7 8 16
7 1 2 3 7 9 10 16
7 2 4 5 6 8 13 14
4 4 7 8 10
8 1...

output:

998122497
997756929
987521025
996538369
997635073
982646785
998122497
996538369
997269505
947552257
998122497
998122497
994832385
997635073
997269505
887111681
998183425
944993281
984596481
901490689
901734401
994832385
997635073
998183425
981671937
917331969
997025793
998183425
975335425
534216705
...

result:

ok 29892 numbers

Test #10:

score: 0
Accepted
time: 4ms
memory: 6472kb

input:

9 26355
8 1 5 7 10 11 12 13 14
6 4 6 9 12 14 18
7 1 5 9 10 11 16 18
7 1 3 6 8 10 17 18
8 1 5 6 8 11 12 15 17
6 8 10 11 12 13 17
4 6 7 8 15
8 2 3 5 7 8 12 15 16
8 2 5 10 11 12 15 17 18
6 1 9 10 14 16 18
7 2 5 6 9 11 12 18
9 3 4 5 6 7 13 14 16 17
9 1 3 6 9 10 13 14 16 18
9 4 5 6 7 11 13 15 17 18
9 1 7...

output:

997391361
993568129
996888705
996203265
998076801
993689985
931771905
997970177
997848321
990308481
997223809
998229121
998229121
998213889
998213889
960560385
997223809
998076801
971024769
998229121
998076801
998076801
997970177
998046337
995807233
998229121
998213889
998213889
996812545
998213889
...

result:

ok 26355 numbers

Test #11:

score: 0
Accepted
time: 8ms
memory: 6620kb

input:

10 23516
8 3 4 5 6 10 15 17 19
10 1 2 3 4 5 6 11 12 13 14
9 2 8 10 12 15 16 17 19 20
9 6 7 8 9 10 15 16 18 20
9 1 2 4 8 9 13 15 17 18
9 1 2 3 9 11 13 15 19 20
10 2 3 5 6 7 9 10 11 13 14
8 1 2 6 7 10 14 15 17
9 2 4 6 7 9 10 13 16 20
9 1 3 4 6 8 12 16 17 18
8 2 3 4 5 6 9 18 20
9 4 5 6 7 10 11 12 16 17...

output:

997928289
998122497
998046337
998191041
998168193
998152961
998122497
997543681
998198657
998168193
997852129
998107265
998000641
997852129
998168193
997821665
998168193
995106561
982646785
991481345
997760737
997817857
998236737
998240545
998229121
989642081
998236737
998229121
979417601
997795009
...

result:

ok 23516 numbers

Test #12:

score: 0
Accepted
time: 14ms
memory: 6792kb

input:

424 100000
2 573 614
2 97 472
2 80 738
2 496 689
2 67 689
2 255 782
2 236 760
2 768 807
2 78 634
2 574 839
2 16 277
2 208 649
2 700 833
2 495 673
2 67 550
2 33 676
2 623 755
2 248 452
2 209 650
2 302 731
2 683 794
2 181 484
2 142 637
2 453 689
2 75 363
2 470 832
2 83 438
2 139 591
2 305 820
2 192 64...

output:

500251737
71459114
376281957
781245545
926558642
130535826
492689612
836331657
451512960
520340648
499122177
482622651
968197558
660496914
528359545
682199824
650647126
151173145
954520149
753606460
886885828
185546645
300257773
147509300
499122177
978183660
941043090
763672826
375756651
263701426
8...

result:

ok 100000 numbers

Test #13:

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

input:

424 80016
3 216 714 738
2 457 655
2 2 652
3 110 569 803
2 242 844
3 450 645 794
2 111 431
2 465 470
3 64 210 450
2 61 477
3 399 695 814
2 653 785
2 518 753
2 616 768
3 43 57 837
2 40 333
2 27 91
3 254 416 527
2 377 566
2 157 500
3 64 177 576
3 117 400 599
3 27 276 368
2 337 569
3 59 167 429
3 196 49...

output:

673405868
59074833
229195676
37867611
544266613
741017403
773005893
630559342
518319993
101206093
964469263
964478874
371468700
672178956
302417057
499122177
499122177
33812301
465919058
22625518
430738213
537605766
748683265
379902066
794856790
58638817
499122177
663272510
388603892
994452316
39759...

result:

ok 80016 numbers

Test #14:

score: 0
Accepted
time: 11ms
memory: 7272kb

input:

424 57094
2 556 699
2 67 779
3 591 652 777
5 181 282 656 714 824
3 219 382 722
2 385 442
2 6 240
3 23 599 803
4 330 370 781 809
2 247 569
5 149 204 493 721 722
4 78 112 713 768
2 33 309
4 222 355 513 772
2 523 539
5 205 255 456 605 804
3 319 557 586
5 1 137 369 425 841
2 79 498
5 9 331 511 543 729
5...

output:

700511585
336208066
250427669
700063600
114567743
597481640
499122177
582205248
916891013
379902066
254425723
384862392
499122177
567618838
947783404
610815158
680031142
972253816
989492967
728992246
382946737
160032912
432451476
836673776
461550803
265481698
195706775
935854081
972829715
246146602
...

result:

ok 57094 numbers

Test #15:

score: 0
Accepted
time: 6ms
memory: 6572kb

input:

424 33397
5 3 14 571 600 641
4 26 32 570 715
4 176 337 471 704
3 327 586 844
2 78 712
2 69 267
8 5 187 388 467 489 531 730 824
4 5 247 301 506
3 320 501 780
8 117 135 345 366 444 551 777 806
2 368 648
5 93 203 453 540 634
3 233 263 494
4 225 599 750 832
6 70 338 431 513 629 630
7 153 243 326 374 699...

output:

258554399
973701407
352006816
672016306
676237528
499122177
448374058
409445405
923158804
884938384
662043080
90899724
940514139
439410877
222127318
991644943
324918103
24312910
385129743
499122177
402263349
348504002
499122177
736265698
930707244
932328766
661738363
101507938
429075514
863284754
24...

result:

ok 33397 numbers

Test #16:

score: 0
Accepted
time: 4ms
memory: 6928kb

input:

424 9013
21 85 134 167 231 309 326 328 345 374 385 393 427 478 563 564 680 727 756 759 768 782
3 138 347 512
8 2 205 414 554 559 650 720 796
42 18 20 58 70 140 178 198 209 217 227 228 243 253 293 296 314 323 330 346 389 397 437 442 470 477 484 486 519 520 533 549 554 613 635 649 668 757 758 771 815 ...

output:

359947232
345763476
153168287
931606672
132253200
661428734
151622956
128128349
248129845
446074605
47681533
890652173
134247310
369407769
814026022
994605875
24496488
609233975
613783092
18536037
802562067
611194094
56786797
488810216
393598191
731411462
781136346
901255528
515714293
365096742
6388...

result:

ok 9013 numbers

Test #17:

score: 0
Accepted
time: 5ms
memory: 7304kb

input:

424 1631
177 2 6 8 10 11 18 25 27 28 31 34 46 47 55 63 64 68 73 74 84 89 92 97 98 110 111 112 115 118 123 127 128 145 147 148 159 161 164 170 173 175 178 180 186 189 194 205 208 210 215 221 223 227 230 232 233 246 250 256 257 258 263 265 270 271 272 286 291 292 295 296 303 306 315 317 323 326 333 33...

output:

694194039
153688206
97225167
327462442
270952193
64454052
471239184
898340252
617538198
772377341
145335918
657026753
654487524
596209356
249986418
144243345
859974184
695542182
451209541
582643515
705256294
389043541
832877353
686526211
985181702
693330512
472626975
938314438
615660280
302969085
74...

result:

ok 1631 numbers

Test #18:

score: 0
Accepted
time: 3ms
memory: 8632kb

input:

424 936
208 8 11 22 24 25 29 34 40 43 48 50 51 53 55 56 58 64 66 69 72 75 77 83 87 89 92 95 97 98 121 133 137 144 147 148 150 158 162 164 166 168 171 172 174 175 177 181 192 198 202 203 205 206 209 213 218 221 225 235 237 243 244 246 249 253 254 259 264 267 276 277 278 279 280 293 295 301 304 313 31...

output:

637032381
804722067
518128766
978435534
354291117
102765860
958720517
578141252
857214629
149021310
458138399
985557886
564646278
306018356
229047947
284820745
224063804
483594130
95114741
227532085
351192862
735043850
282960612
13266812
781740524
962416625
706515260
615095936
794550857
691186191
73...

result:

ok 936 numbers

Test #19:

score: 0
Accepted
time: 11ms
memory: 6540kb

input:

908 100000
2 602 1144
2 643 1735
2 666 871
2 270 371
2 317 958
2 334 753
2 238 684
2 384 1545
2 664 1519
2 1553 1614
2 671 837
2 201 448
2 1100 1229
2 823 1528
2 504 1544
2 361 1133
2 1088 1491
2 564 1227
2 484 1439
2 40 154
2 663 1275
2 988 1353
2 103 1496
2 529 982
2 465 726
2 1441 1609
2 858 1678...

output:

432469389
435243083
499122177
499122177
829787609
499122177
499122177
804904146
769298409
469986033
499122177
499122177
606841122
503571031
260810735
150328567
582094515
254992895
210488507
499122177
238184989
383271412
783772468
312261328
499122177
956211490
508330899
499122177
499122177
265928621
...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 14ms
memory: 7328kb

input:

908 80013
2 594 1257
2 15 1649
2 349 736
3 531 777 1308
2 24 480
2 1061 1401
2 367 709
3 838 1048 1427
3 283 413 1588
2 513 1208
2 151 801
2 907 1149
3 250 458 1186
3 865 1412 1785
2 523 1726
2 400 1452
3 5 1481 1697
2 39 555
3 872 973 1755
2 52 287
3 603 835 1511
3 790 1001 1086
2 1066 1515
2 989 1...

output:

632546817
274424826
499122177
698761716
499122177
365205676
499122177
88714289
911798516
281291738
499122177
805357867
754761170
259946376
43362555
488685527
2192658
499122177
804704813
499122177
946903403
901640397
587720717
166656670
277636163
219433210
934425197
127515040
228760560
380589266
7115...

result:

ok 80013 numbers

Test #21:

score: 0
Accepted
time: 8ms
memory: 6880kb

input:

908 57015
5 435 731 844 986 993
3 837 1278 1523
5 282 558 916 1055 1423
4 66 377 1375 1474
5 213 915 1150 1367 1702
3 316 587 1564
3 1136 1363 1762
5 300 585 1284 1291 1361
3 115 141 305
4 436 624 1228 1504
4 416 490 764 1493
4 515 598 642 1603
5 43 260 505 1123 1249
3 748 1101 1637
2 576 749
5 230 ...

output:

988976599
129702419
755388476
676296593
243230068
690933289
542601916
569946365
748683265
226656245
579062397
239819203
832795720
506577775
499122177
389854255
241571803
499122177
499122177
87223422
12008562
953410021
780624479
499122177
490447832
695999711
194024541
811850361
451556207
384008170
60...

result:

ok 57015 numbers

Test #22:

score: 0
Accepted
time: 6ms
memory: 7224kb

input:

908 33295
4 48 210 601 928
7 137 412 1116 1138 1217 1304 1729
10 41 335 624 733 812 1370 1416 1653 1679 1743
5 113 123 399 1030 1719
4 1022 1238 1253 1804
4 35 46 817 1027
2 295 527
5 119 311 484 1011 1588
4 434 529 650 654
5 496 856 967 1342 1701
6 239 387 610 710 834 1303
8 346 459 626 913 1070 11...

output:

479553800
483145800
845059321
894502961
19997121
755783610
499122177
157575622
873463809
249350177
905302670
223023041
935854081
472767241
77979538
60842379
683141814
705050572
215061784
686975673
287559677
358024870
329045213
851501827
499122177
477991365
748683265
370020528
650370407
298825801
197...

result:

ok 33295 numbers

Test #23:

score: 0
Accepted
time: 4ms
memory: 7044kb

input:

908 9016
34 74 90 142 179 209 210 234 283 294 297 311 318 350 363 452 542 633 655 676 680 885 940 945 1062 1231 1321 1396 1481 1527 1558 1620 1667 1716 1726
28 15 192 204 251 354 355 398 426 438 605 640 702 824 1149 1166 1172 1224 1248 1266 1274 1296 1340 1364 1513 1606 1661 1719 1720
22 25 128 151 ...

output:

684850922
102685465
587602018
192803081
104356753
886094449
339644376
684905730
986235788
397866013
629989612
178560870
179916283
993853267
409989514
595179362
364598370
364432178
411029211
491675779
997621910
435973655
722810556
793831288
404271642
317295242
388266240
157032313
915948369
996397673
...

result:

ok 9016 numbers

Test #24:

score: 0
Accepted
time: 7ms
memory: 8108kb

input:

908 1635
18 16 21 31 130 146 251 430 454 800 816 1019 1037 1128 1160 1163 1299 1654 1759
123 12 22 31 44 101 114 124 125 136 176 188 213 225 254 256 257 258 293 298 325 351 355 361 370 372 405 422 434 435 443 550 582 596 601 604 606 619 641 645 647 668 701 718 723 734 737 743 765 778 796 797 813 822...

output:

776414659
966574330
929954042
583747197
281282988
434326834
31556607
899407597
961260367
570768904
423675446
658161366
382009235
933429025
925465940
186719797
783228767
722585074
552223410
233334409
512223827
435519626
190286079
392230404
976978121
856828918
195264966
810478712
444283232
17936506
99...

result:

ok 1635 numbers

Test #25:

score: 0
Accepted
time: 11ms
memory: 9000kb

input:

908 438
604 4 6 9 11 14 15 19 21 24 28 29 34 37 38 39 44 45 47 52 53 54 55 57 60 62 63 75 79 81 82 86 87 90 91 95 97 100 105 106 108 110 111 113 115 116 118 119 122 128 130 131 133 134 138 139 141 142 147 154 159 160 166 170 172 178 179 183 185 192 193 194 195 196 205 211 212 213 216 221 222 231 235...

output:

8874719
978103948
216347762
150730405
234108521
403971551
871699306
492073378
258631866
616427154
142870225
593743354
127762407
665284909
867565706
973174176
597870964
932641423
908730094
77063154
668119019
370933544
290374999
20996680
165936721
697304357
631693643
348986941
658126902
198323352
3341...

result:

ok 438 numbers

Test #26:

score: 0
Accepted
time: 7ms
memory: 7352kb

input:

1000 100000
2 5 1306
2 809 1238
2 106 1911
2 322 760
2 765 1915
2 1706 1943
2 305 792
2 250 1191
2 152 1802
2 421 1720
2 218 277
2 940 1499
2 38 657
2 157 543
2 1496 1654
2 1222 1600
2 448 1475
2 629 1189
2 968 1433
2 483 536
2 470 1322
2 101 206
2 809 1546
2 142 1679
2 998 1251
2 206 1330
2 6 297
2...

output:

461072407
618532200
635672046
499122177
150761876
536232691
499122177
16863774
183968102
365296282
499122177
332550455
499122177
499122177
530974872
833563576
393138104
896730731
184585004
499122177
126148624
499122177
531464645
123018767
379597290
261949548
499122177
499122177
583253406
725478266
4...

result:

ok 100000 numbers

Test #27:

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

input:

1000 80037
2 790 1432
3 196 751 1622
3 55 291 1378
2 367 1611
3 336 513 1720
3 544 857 1477
2 19 863
3 1315 1439 1803
3 309 1069 1529
2 275 1998
3 531 1114 1174
2 1038 1715
2 424 830
2 284 317
2 89 913
3 638 1473 1984
3 76 368 1925
3 1039 1076 1372
3 398 904 1788
2 4 816
3 273 1026 1727
3 254 811 19...

output:

64360552
680147341
924586857
308333209
614857370
882591355
499122177
576098832
110247542
128928877
176768765
336267947
499122177
499122177
499122177
244882497
370990200
267750996
876918713
499122177
403509656
324491909
876752317
697133465
132265652
544116326
89094649
748683265
473686315
526858327
67...

result:

ok 80037 numbers

Test #28:

score: 0
Accepted
time: 12ms
memory: 7084kb

input:

1000 57071
4 453 939 1102 1240
4 42 632 1262 1776
4 46 777 1301 1988
4 309 542 609 665
5 451 896 917 1322 1460
5 281 1467 1760 1815 1847
2 833 1374
4 519 802 1365 1562
5 269 477 935 1400 1485
2 208 1746
2 883 1099
3 565 1267 1324
2 451 1919
3 888 1754 1961
2 254 465
2 436 831
2 799 1897
2 1640 1694
...

output:

334164362
63611945
468356671
873463809
463163257
636386848
213774240
304964654
946112830
175983160
727959123
802929023
633805109
313596787
499122177
499122177
176865197
278032754
447336726
612527929
891388978
150761876
499122177
292229500
508451066
862126345
809312824
807242786
832074471
218869217
9...

result:

ok 57071 numbers

Test #29:

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

input:

1000 33411
9 186 408 494 520 549 802 1060 1422 1942
8 21 312 406 478 495 613 652 1553
8 626 671 793 839 990 1197 1624 1826
8 712 923 988 1439 1757 1831 1959 1961
5 632 640 872 1687 1727
10 348 395 608 762 1353 1382 1688 1820 1884 1988
2 1150 1612
7 193 261 301 371 638 1594 1775
3 451 1822 1913
5 264...

output:

783071650
879361056
712438530
87941039
752527806
576201403
93051353
458068021
876377918
461888158
389816871
889156906
869579673
23144493
111925156
472751060
635526842
671610399
113556153
909221012
810730991
723888316
514301430
205496995
242426632
564212446
499122177
599529771
396121394
124062330
445...

result:

ok 33411 numbers

Test #30:

score: 0
Accepted
time: 6ms
memory: 6796kb

input:

1000 9065
10 48 64 213 581 1170 1302 1337 1551 1682 1999
7 1 2 1038 1110 1724 1791 1911
15 39 391 486 576 592 688 822 847 925 933 940 991 1021 1362 1933
9 720 762 872 929 950 955 1590 1755 1899
11 109 129 214 240 379 817 1321 1473 1594 1612 1657
35 40 60 61 180 235 325 362 544 610 627 642 662 679 74...

output:

898795304
69360371
150329788
697099451
407149592
634852290
538579791
652623196
1200742
47685366
270024627
976855118
488736876
880042496
59777035
577543744
712415117
495931564
566660830
667332267
162545259
748005013
903952572
467763975
771446190
522970315
262057830
20722403
982369038
181876703
293327...

result:

ok 9065 numbers

Test #31:

score: 0
Accepted
time: 7ms
memory: 8376kb

input:

1000 1683
128 3 17 33 46 50 55 58 63 73 85 116 144 157 197 217 229 243 252 256 275 295 319 321 324 328 343 350 400 409 424 429 431 436 440 444 469 492 503 544 555 559 575 582 585 607 618 622 629 647 651 684 692 703 733 763 770 786 788 807 808 819 825 829 832 885 901 912 953 987 989 993 997 1001 1015...

output:

624712570
555970681
142276974
880338058
459253539
443842894
987754490
144538388
299714805
857067442
109504005
840964113
955909875
412556064
742721771
544084126
421008944
697955998
500966143
174496901
921107295
781175080
863440606
143642513
337736560
568585107
361418691
595833702
839430031
421188800
...

result:

ok 1683 numbers

Test #32:

score: 0
Accepted
time: 7ms
memory: 9128kb

input:

1000 386
949 1 2 4 6 8 11 13 15 17 19 21 23 24 26 28 29 30 33 34 35 36 38 39 41 43 44 50 52 55 56 57 62 63 64 65 66 67 70 75 76 77 80 82 83 87 92 93 94 95 97 100 103 107 109 111 112 116 119 127 129 130 131 132 133 135 137 141 142 143 144 145 146 147 150 151 153 156 159 163 166 167 168 169 170 171 17...

output:

167324407
535384118
506186107
145446725
661673145
110891065
622909173
609757981
22965290
827842946
111216736
976515752
911003748
532549034
412402561
526791780
41604828
480442269
973186266
951176447
13638307
199501161
227038849
334337439
222703013
68805267
104559025
244072885
48164590
365506110
17838...

result:

ok 386 numbers

Test #33:

score: 0
Accepted
time: 17ms
memory: 7168kb

input:

40211 100000
2 13602 33495
2 22521 43095
2 9285 28105
2 36531 53101
2 34750 78552
2 17202 48763
2 565 18755
2 40308 69681
2 51120 51865
2 25067 35192
2 57801 74384
2 21421 63509
2 50036 57314
2 44264 73804
2 9301 79858
2 15277 33465
2 623 62871
2 46357 64170
2 44522 65729
2 33792 76118
2 35663 60797...

output:

499122177
791078450
499122177
580665213
833751686
775700222
499122177
262414963
795569380
499122177
976158321
386043343
31834524
282301057
772529712
499122177
432082522
614561649
835462479
29766727
79842648
499122177
977962810
783255856
497955563
148176883
588978251
499122177
876367501
517582948
499...

result:

ok 100000 numbers

Test #34:

score: 0
Accepted
time: 16ms
memory: 7124kb

input:

40211 80052
3 15025 28071 67073
3 20121 47324 80151
3 4354 18731 69746
2 39234 47988
2 67860 77836
2 27518 43441
2 16104 76277
2 25597 43070
3 6797 19240 78499
3 25873 43182 62700
2 63854 75614
2 22019 61500
2 67540 69024
3 12547 39522 67694
3 8683 17655 58907
3 17622 51181 53133
3 1945 8459 30728
2...

output:

420730842
989915855
768008305
152803540
166905870
125431040
793846988
157268460
803488160
478777783
896484159
978926632
854560034
432367293
756028075
139549303
748683265
499122177
23247947
982464384
505561127
289279150
926912423
840691100
486518797
817468665
476227643
132766919
154884223
904299652
8...

result:

ok 80052 numbers

Test #35:

score: 0
Accepted
time: 12ms
memory: 7216kb

input:

40211 57062
5 11931 36755 41746 50147 60386
2 16078 32674
4 3879 10666 18942 62605
4 1402 12452 14763 26574
3 19083 29460 35084
3 14397 35804 39734
2 32199 58961
3 52229 62612 79935
4 17350 42501 56545 64086
3 5685 27721 45226
5 1487 26753 37245 70835 76819
2 35852 37172
2 30252 71095
3 44056 53223 ...

output:

84410991
499122177
667325413
873463809
748683265
748683265
263516546
254986080
411902519
306448901
173536389
499122177
320982690
525677993
956196224
984286393
838584496
167513901
652945923
453915490
118461194
474054269
205749194
671230590
963629262
415033512
748683265
808822631
694645681
790334324
7...

result:

ok 57062 numbers

Test #36:

score: 0
Accepted
time: 12ms
memory: 8772kb

input:

40211 33279
2 47591 76705
8 19395 55380 59615 60904 65094 71224 78596 80036
5 512 9328 27590 31074 46996
10 33184 33563 34050 37740 45595 48505 49242 58487 64344 66126
10 16429 17094 20989 45988 47018 47277 50771 71499 78971 79828
8 12222 12425 13733 33408 58299 73087 77976 79336
2 50239 56822
7 744...

output:

341887307
376398411
702250192
955678420
594294777
292567501
607921281
730702711
802472277
84971699
147446120
435175100
585308749
260860182
302443565
652240886
257574454
342770735
748683265
595025614
533039552
189485594
148251195
748683265
899608858
328474034
453037009
687663041
401314970
182590638
7...

result:

ok 33279 numbers

Test #37:

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

input:

40211 9078
4 3478 14951 45751 55495
6 15182 38686 38821 50339 62027 72910
21 1247 2016 6383 8487 11391 14636 17795 21974 22068 25664 25792 43761 46294 46902 47841 51383 67438 70789 73260 77819 79953
35 5891 7959 9850 11276 12760 14330 14775 15242 15393 19093 20851 21040 23586 26147 26829 27084 29143...

output:

577329830
753006895
151777145
835483662
258548499
55415783
445767377
69422755
692113594
903230784
611606728
985897714
890377379
168443707
814252345
446883659
586784085
623191208
804159877
173755470
109716804
170251856
20051754
821513794
658913347
932933299
299156457
925971945
717944793
464004317
855...

result:

ok 9078 numbers

Test #38:

score: 0
Accepted
time: 116ms
memory: 82200kb

input:

40211 1641
23 1828 4791 5173 15025 16298 23113 28263 32438 36578 37786 37902 44461 46189 52703 56028 58416 60957 63349 65685 68710 68950 71410 73160
94 605 1353 1483 1843 1999 2818 3089 3823 4275 4314 5349 5840 8373 11089 11964 12194 12235 13140 13396 16415 16798 17142 18713 20144 21080 21114 21532 ...

output:

51225244
627364892
963081936
844376698
611200490
554201106
504605322
841547844
631754462
39467946
639573902
642284583
33356843
156045716
414282305
678495039
968956748
608034004
774299046
567976548
653463382
821316633
211919471
155073027
73734216
403646846
638995246
489360206
883821795
44491016
68248...

result:

ok 1641 numbers

Test #39:

score: 0
Accepted
time: 152ms
memory: 98988kb

input:

40211 338
314 112 120 666 1000 1051 1144 1330 1339 2308 2795 3079 3278 3313 4741 4922 5048 5506 5883 5915 6506 6554 6869 7002 7062 7155 7315 7439 7495 7604 7662 8491 8496 8513 8556 8809 9104 9326 9744 9794 10338 10343 10573 10745 10922 11660 11888 12034 12550 12616 13142 13635 13805 13832 13846 1441...

output:

909102945
550048933
628553834
509511038
52295539
716451730
651106321
843912336
797007977
959284150
831979337
784616593
923010935
354114487
853118794
535736075
660687157
719658207
793270585
848165173
17775155
782042320
607190672
987262603
390356724
727454030
452380949
6408365
415939672
169728638
9084...

result:

ok 338 numbers

Test #40:

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

input:

40211 31
6169 22 35 58 59 62 70 76 93 116 133 141 176 189 204 239 249 253 274 280 285 306 315 335 341 355 357 364 416 422 427 459 464 475 480 485 487 491 518 519 533 572 575 581 595 614 620 632 638 650 660 684 699 720 723 724 739 743 749 760 797 802 806 807 817 836 838 853 881 897 915 917 930 944 94...

output:

1036046
831863415
894838905
4630371
361432695
42354724
413624923
529199965
369623750
266747881
64167554
369752582
252823200
318643752
341768866
629370394
537844080
130193613
132143234
36484111
791751265
845708003
870008445
151601689
363937426
916891587
937508455
944692649
615294192
435383662
499122177

result:

ok 31 numbers

Test #41:

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

input:

40211 22
39282 2 10 11 14 19 20 22 24 25 26 27 30 36 39 42 43 45 46 48 50 53 54 58 59 60 63 67 68 69 70 71 72 76 77 83 85 89 90 92 94 96 97 101 106 110 112 117 122 124 127 128 129 130 131 133 134 136 137 138 143 144 146 147 148 149 150 151 153 154 155 160 161 162 165 167 169 170 171 172 175 176 179 ...

output:

478670876
967954284
303712175
439254500
796544729
573615028
364894511
657322566
621419904
405561863
872417004
119271243
512442014
132855204
716940153
817507908
174706273
773712504
244177656
807371261
496442717
540505489

result:

ok 22 numbers

Test #42:

score: -100
Runtime Error

input:

97708 100000
2 88069 93693
2 24671 96212
2 21203 81148
2 70751 151047
2 47680 88488
2 63454 145578
2 92202 151392
2 48183 176030
2 9366 112306
2 86876 89322
2 48051 169014
2 103864 135648
2 190098 194567
2 29292 139808
2 66965 110008
2 19276 175620
2 31932 110886
2 20494 35870
2 100687 118390
2 8737...

output:


result: