QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#69424#5042. FlowyukorniAC ✓72ms42716kbC++141.0kb2022-12-27 15:36:052022-12-27 15:36:08

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 34576kb

input:

4 3
1 2 1
2 3 2
3 4 3

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

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

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

input:

100000 199996
1 2 0
1 3 0
1 4 0
1 5 0
1 6 0
1 7 0
1 8 0
1 9 0
1 10 0
1 11 0
1 12 0
1 13 0
1 14 0
1 15 0
1 16 0
1 17 0
1 18 0
1 19 0
1 20 0
1 21 0
1 22 0
1 23 0
1 24 0
1 25 0
1 26 0
1 27 0
1 28 0
1 29 0
1 30 0
1 31 0
1 32 0
1 33 0
1 34 0
1 35 0
1 36 0
1 37 0
1 38 0
1 39 0
1 40 0
1 41 0
1 42 0
1 43 0
...

output:

49999000000000

result:

ok 1 number(s): "49999000000000"

Test #4:

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

input:

3 2
1 2 8
2 3 10

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #6:

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

input:

10 16
1 6 3
1 4 8
7 10 5
5 10 2
1 7 10
8 10 6
3 10 2
6 10 9
1 9 1
1 2 8
1 3 3
1 5 9
1 8 4
9 10 3
2 10 9
4 10 1

output:

15

result:

ok 1 number(s): "15"

Test #7:

score: 0
Accepted
time: 40ms
memory: 33740kb

input:

100000 99999
9700 37675 798072605
15495 90321 163368077
54399 92257 709210444
63319 92520 67520422
93508 30166 74547790
6947 86623 360482956
61958 55848 466736402
57810 92446 227585203
22096 13029 376961481
67744 64049 894979704
61006 19164 905021001
66772 87485 936298648
35501 71719 742844695
88521...

output:

12518855895642

result:

ok 1 number(s): "12518855895642"

Test #8:

score: 0
Accepted
time: 52ms
memory: 42148kb

input:

100000 199996
1 26663 319818544
1 13675 381416274
95884 100000 357045100
74770 100000 312492167
1 94245 199481444
1 89084 357597449
1 44869 796658525
51859 100000 301823532
1 69385 986854603
34566 100000 630859678
72982 100000 277482766
1 98659 43040144
31271 100000 711562870
48068 100000 90362013
7...

output:

16603075275851

result:

ok 1 number(s): "16603075275851"

Test #9:

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

input:

100000 199996
7045 100000 896426716
76796 100000 679041122
1 47443 300651279
62855 100000 169107035
1 91363 10524216
1 37552 297675942
1 38448 113866661
1 72793 818781339
1 50663 753284834
6288 100000 226245876
30910 100000 480172195
89323 100000 524055779
50586 100000 949012073
32228 100000 9426320...

output:

16635681185277

result:

ok 1 number(s): "16635681185277"

Test #10:

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

input:

100000 149997
14419 1561 274207885
83536 100000 39294158
67467 100000 602395267
40189 51832 642421443
10904 100000 531895322
76835 81591 801936327
1 70734 947423482
1 57891 226687027
1 39799 743379051
93543 100000 899005151
26357 23311 117493281
1 6649 314347003
18402 100000 927043195
33319 100000 2...

output:

12535273949303

result:

ok 1 number(s): "12535273949303"

Test #11:

score: 0
Accepted
time: 61ms
memory: 35244kb

input:

100000 149997
1 9231 932955576
30620 100000 719978370
1 40093 357198401
1 34631 668849404
57137 100000 558934027
1 62865 969235768
30025 100000 541428215
1 18336 62389481
40410 100000 312180730
15007 100000 553327330
9667 100000 825480993
93157 63776 570667384
1 76401 963514933
69616 100000 73988257...

output:

12472257870392

result:

ok 1 number(s): "12472257870392"

Test #12:

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

input:

100000 100000
34515 13190 977742361
20513 28489 995722642
32419 26056 811895567
59221 24444 242734607
95196 13086 873803734
96421 69037 576843698
66235 67928 81351296
60586 10244 255573158
90444 98601 901670001
12990 426 679784115
62071 36704 220174504
56259 36036 576803340
43799 68489 307286567
516...

output:

12473367661180

result:

ok 1 number(s): "12473367661180"

Test #13:

score: 0
Accepted
time: 72ms
memory: 37312kb

input:

100000 199996
1 82598 247596837
1 85534 333844371
1 41322 715308300
11915 100000 986963831
37077 100000 672455669
62494 100000 48618809
1 69123 918770198
1 90209 185230790
47558 100000 808066963
1 24763 265095626
37839 100000 361288873
1 9729 953966535
1 52304 6030834
95140 100000 465407597
32828 10...

output:

16620066384947

result:

ok 1 number(s): "16620066384947"

Test #14:

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

input:

26043 26042
6539 20396 990614068
19155 2058 7434436
10059 24942 800730799
18765 685 485063101
524 4982 691375730
3398 25045 843787823
8357 2452 332601268
25277 10484 549653995
25104 14108 407058723
14884 21596 44500491
13792 2924 268346953
23117 621 447776680
14465 12941 771783689
16777 10214 278653...

output:

3251384219123

result:

ok 1 number(s): "3251384219123"

Test #15:

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

input:

36576 54861
11583 9857 14473315
7112 8983 419177205
36283 8139 585447157
1 6993 744133035
10183 36576 450456617
1 3514 913980559
1 35298 323579337
11777 19211 6444827
32948 33245 940221490
20916 2424 198052320
30994 2642 677971055
2820 14501 717287250
1 3403 680497692
1 27853 840872357
32274 33881 3...

output:

4552532643354

result:

ok 1 number(s): "4552532643354"

Test #16:

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

input:

27645 30156
8120 13855 223767280
24803 26991 179556048
14946 17423 44100044
10701 27645 513429107
20468 21918 850123403
1 26218 491026733
5108 20209 917964013
20654 27645 499802099
18328 6312 857990458
18058 6555 909308426
1 12354 9194970
23017 23852 964708152
18722 15684 295650821
17954 18738 13475...

output:

3483710412493

result:

ok 1 number(s): "3483710412493"

Test #17:

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

input:

27932 29400
1720 20447 123059920
12502 12753 980805551
26785 16865 39771503
13959 4108 955981099
9003 8897 629957515
21311 10158 507096716
502 17375 565820327
7729 20302 221347345
11209 16311 759594739
19511 14616 528197947
4844 2524 392890658
16228 7558 431219699
24872 1845 640114626
15777 3310 206...

output:

3476819421052

result:

ok 1 number(s): "3476819421052"

Test #18:

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

input:

19001 21110
3999 14515 458837027
6806 7378 264626298
8053 13184 915972060
1282 1965 572173230
1 384 80515832
14870 4644 171238655
16183 6763 19337314
2299 11098 323912487
14593 15355 945028882
2550 2940 511536345
16908 10411 708125496
1 16176 520126900
16184 8426 201920212
1 14447 579815963
18294 28...

output:

2390066062782

result:

ok 1 number(s): "2390066062782"

Test #19:

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

input:

10070 10069
5860 5340 566505515
1554 7818 268866545
2546 8712 392437539
571 8675 178159905
9512 2738 507148888
3064 5640 875165763
2941 9367 444357059
8909 1322 580676640
804 3182 78440475
2559 5944 510519997
6465 6983 424656047
623 6393 220130911
4213 383 825661260
2512 1726 30769068
98 4399 664586...

output:

1245850499999

result:

ok 1 number(s): "1245850499999"

Test #20:

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

input:

20603 20628
19228 10978 743241901
5233 10099 726654870
11030 147 586624042
3516 15035 102004580
11331 4892 184246257
10846 13740 676985644
4416 2137 549706650
10673 2231 746986646
16306 18706 649110374
14979 11495 531395968
16714 3375 482236158
1387 7948 143138563
16260 8554 444298163
12857 4728 194...

output:

2583329335371

result:

ok 1 number(s): "2583329335371"

Test #21:

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

input:

11003 11580
7405 10109 879667451
1 1516 151493537
4270 5932 627964113
1899 1280 205082864
3119 854 311673195
4496 3413 264445735
8388 9597 570267932
5305 1459 965737320
7075 2010 484148550
6387 3841 824932571
3216 8011 947729199
2369 9449 277040969
8883 2821 129601896
31 3962 240741121
4956 5685 600...

output:

1386147620537

result:

ok 1 number(s): "1386147620537"

Test #22:

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

input:

21535 43066
12587 21535 6254045
15445 21535 784166389
1 14467 214858299
1 7843 697258161
19914 21535 613875727
6360 21535 530649309
2306 21535 147351236
1 16503 899719059
1 12427 102030294
2541 21535 557542077
4516 21535 562103070
13873 21535 688721524
1 16619 372775489
1 9238 391443526
1 5444 64881...

output:

3585206876675

result:

ok 1 number(s): "3585206876675"

Test #23:

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

input:

12604 25204
1 6097 741642929
11025 12604 639748333
1 5106 659470620
1 10882 375845504
1 4246 980108509
10831 12604 976051462
1 1466 232813177
1 10324 632597659
4753 12604 210462366
4092 12604 597348214
1 6906 675616119
1 7482 563144443
2951 12604 855959884
6747 12604 997548048
1 5154 883827097
1 56 ...

output:

2100340909518

result:

ok 1 number(s): "2100340909518"

Test #24:

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

input:

2645 3524
1 1259 636059047
1596 592 46090283
1199 1221 77891981
1098 2645 402750837
1 1961 486563476
1210 2645 50730864
114 2645 130640398
1 2197 919473188
417 2030 387878126
1 1181 472113798
396 2297 821827540
2257 2514 582429301
2602 2645 853799599
1713 1992 533905799
155 2554 404473818
2180 2379 ...

output:

346904880130

result:

ok 1 number(s): "346904880130"

Test #25:

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

input:

3960 7916
832 3960 599894994
1 1323 120886915
1 2448 793675349
1 3490 221077741
1 992 897326867
1 2485 969823271
3431 3960 553814317
3806 3960 659272664
3626 3960 447714167
1 3808 951339360
1 596 353267951
1 2474 19081116
3717 3960 765783959
1 1280 198220013
1 3179 836270439
1 413 363557702
1 2880 5...

output:

653947493665

result:

ok 1 number(s): "653947493665"

Test #26:

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

input:

4247 4246
2213 2539 643648615
1213 1293 532642289
4087 422 745299079
1231 1693 726574371
2966 310 518196348
768 2885 863378188
5 2095 134574290
271 414 836392544
3623 1778 770190304
3583 1704 291141985
869 983 422611807
2155 1979 659672403
3346 306 129596176
1995 3510 349997750
2364 3993 238797408
5...

output:

532710689593

result:

ok 1 number(s): "532710689593"

Test #27:

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

input:

95315 127084
42601 33316 143233626
47072 64659 97117642
51513 17527 231461232
39180 95315 846947826
76176 38049 133681393
20006 39005 238536586
1 10943 246291192
32959 95315 639975733
20089 23789 821406090
76910 95315 177899680
72883 63749 337074074
42288 86693 343344424
1 11102 610081559
1 4821 518...

output:

12785143229477

result:

ok 1 number(s): "12785143229477"

Test #28:

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

input:

2 1
1 2 0

output:

0

result:

ok 1 number(s): "0"

Test #29:

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

input:

2 1
1 2 1000000000

output:

0

result:

ok 1 number(s): "0"

Test #30:

score: 0
Accepted
time: 66ms
memory: 38708kb

input:

99999 199994
14664 99999 367453816
1 98610 509560259
71153 99999 670422851
1 88170 811407634
1 37068 692257480
1 37395 7390825
61991 99999 137720822
1 66822 76830696
87544 99999 646421928
1 88419 859576812
45093 99999 282168058
74595 99999 993437871
1 80821 368833772
1 62710 736995683
1 48820 223625...

output:

16705019510150

result:

ok 1 number(s): "16705019510150"

Test #31:

score: 0
Accepted
time: 26ms
memory: 34052kb

input:

99999 99998
28274 86083 524066612
49014 45645 438278443
99281 23716 42779663
33548 99397 521211201
47591 66419 57850048
50965 16540 17096546
92240 87261 12483803
90427 80350 346775433
88436 92027 146317272
52342 62390 621700175
39957 35963 448703947
20834 90320 434003455
86213 45350 694571793
40324 ...

output:

12518322841649

result:

ok 1 number(s): "12518322841649"

Test #32:

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

input:

99999 100274
16513 75511 554300673
84671 5917 339519037
52066 12948 62999958
45013 83437 132345336
97291 12361 915619053
86077 26111 872761949
95062 48446 980621514
72898 83524 912635913
30850 40787 465106479
48577 95843 232916269
62724 36644 778419429
13930 65609 809903728
73536 23082 91393912
7912...

output:

12485670094713

result:

ok 1 number(s): "12485670094713"

Test #33:

score: 0
Accepted
time: 29ms
memory: 33820kb

input:

99999 99998
21841 26102 638107006
71886 78040 673555289
38883 85122 643429854
19218 24020 505102877
243 84487 487485824
63770 7303 668192326
5461 11179 641271829
7975 4555 331650850
71998 36799 218405597
30537 79657 107172036
8549 1919 285886000
15790 57485 368832009
77025 25506 209184964
69458 7824...

output:

12479627729936

result:

ok 1 number(s): "12479627729936"

Test #34:

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

input:

99999 105260
90918 5802 777942546
56664 91176 826431413
96667 40641 378245868
85750 69956 366414538
12377 38313 643900224
1 36314 60097420
1 58594 728042669
20008 38163 608647418
71991 55824 105170515
76698 56126 271445758
18641 97638 141372741
20826 30240 651061303
2926 79453 811709098
70420 69054 ...

output:

12539308412614

result:

ok 1 number(s): "12539308412614"

Test #35:

score: 0
Accepted
time: 69ms
memory: 42716kb

input:

99998 199992
90173 99998 249526297
1 59854 261287061
52245 99998 715294182
27783 99998 51906851
1 20652 633558056
1 98559 417459393
1 50598 985996095
1 91776 88986236
1 72700 318215889
16957 99998 30483415
29485 99998 894900605
77338 99998 929632188
1 82082 963000593
68617 99998 879420339
1 84205 43...

output:

16704377694358

result:

ok 1 number(s): "16704377694358"

Test #36:

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

input:

99939 99938
6375 72815 991649507
39869 10047 756300974
86483 7290 22631201
58539 45731 347976892
58632 39054 863449144
21545 64223 808788481
43609 47561 543482156
40988 78178 883944865
15550 95792 437067393
77532 83629 601801762
43012 92176 598298831
62179 94851 837886279
61455 51991 393879297
44418...

output:

12461784111644

result:

ok 1 number(s): "12461784111644"

Test #37:

score: 0
Accepted
time: 40ms
memory: 39364kb

input:

99399 99398
99278 11407 915502143
9758 7742 433229909
69903 87303 763212460
55808 64985 765727569
65137 30634 36900766
26309 98652 754958695
25385 86080 81236941
64187 94820 889827340
86330 90897 180301985
41002 68974 456547079
42250 56600 953428348
39917 37845 81138624
55639 94427 187571890
17139 1...

output:

12417880447807

result:

ok 1 number(s): "12417880447807"

Test #38:

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

input:

93999 93998
12539 87508 210924471
66455 60850 407393037
86291 48892 297301470
12960 45014 189951129
31917 45830 374360473
31415 92578 325960933
31116 23027 442487979
64483 68426 346971614
47277 45942 339115745
30792 86146 129191589
31172 46591 717740224
4012 59822 398318
91714 65441 361816845
57596 ...

output:

11746677420973

result:

ok 1 number(s): "11746677420973"

Test #39:

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

input:

99599 99598
50478 62518 407133714
99210 98285 740367251
75066 32734 829882823
31158 61175 565198057
53201 68131 64162368
8012 94313 151092986
84952 16849 373590241
31866 96871 89022649
23277 30351 865329945
71766 16785 813352947
90540 20666 535228088
71213 40489 423399753
77215 76068 966097175
36895...

output:

12494134332266

result:

ok 1 number(s): "12494134332266"

Test #40:

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

input:

73232 80553
12691 62256 56769958
42627 43254 137267677
24348 28210 75859917
18772 3731 102997186
25525 5297 903287961
59495 15940 683863290
1 9099 268472504
6006 73232 482374553
2155 60022 464488089
36090 26509 990009693
30666 53159 496199171
69488 73232 278987458
40399 70669 45649106
70186 49390 87...

output:

9142982795968

result:

ok 1 number(s): "9142982795968"

Test #41:

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

input:

73518 73518
43169 1495 476523773
465 43300 521998597
60149 47877 878772857
44125 37082 666383069
20702 19151 700160628
34397 47890 58873353
32223 55344 343325272
57200 63517 789781398
1509 54157 545507859
50891 8213 887118140
35987 3502 883625376
37132 36042 147437089
17004 39027 906916514
64183 660...

output:

9228439283768

result:

ok 1 number(s): "9228439283768"

Test #42:

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

input:

64588 64587
39514 53622 984345494
3806 19630 363117798
44536 61095 87111881
38550 3286 377537257
62115 14935 938696738
49470 5485 683957100
6524 57649 434372911
18997 37323 844464346
5695 11490 167604423
59152 24023 407578965
4946 31513 698944680
59334 17940 638664281
21631 31800 167372556
7434 6453...

output:

8093285935149

result:

ok 1 number(s): "8093285935149"

Test #43:

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

input:

64205 85604
22402 4222 759107911
46641 64205 248367104
25560 55165 670395546
11798 38708 173867269
14704 64205 55531217
58058 4514 603557668
42160 1439 286214137
35024 64205 75813329
28266 21901 195764127
35623 64205 389994573
12155 64205 417404470
33030 64205 943531405
1 27528 317105071
1 19084 637...

output:

8556033897345

result:

ok 1 number(s): "8556033897345"

Test #44:

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

input:

55274 56259
3435 47427 812334580
48328 14215 260535886
32115 9750 629352622
53959 31672 697515617
10344 14669 985466758
47666 28638 388029234
52478 27778 846285126
45540 21166 383838785
24879 15281 826910711
7190 10636 283427977
1 52022 111917774
34379 21503 735860689
16058 323 434764271
4405 7181 5...

output:

6944660198838

result:

ok 1 number(s): "6944660198838"

Test #45:

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

input:

65807 65806
775 50764 681936759
62006 47529 635907393
50225 24805 228153300
59470 29359 523709435
34545 56749 935673213
61727 19505 554315445
46311 38132 853136123
56792 55770 384959385
61978 56032 661397232
5907 11556 19265469
59964 8847 510704032
42451 39666 171015300
15018 24537 117713053
5366 39...

output:

8240423345310

result:

ok 1 number(s): "8240423345310"

Test #46:

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

input:

56876 113748
35035 56876 753125502
1 25482 669395948
27992 56876 743242075
39994 56876 36797287
1 3736 967513982
48499 56876 210300805
40401 56876 749461559
42882 56876 269443632
7831 56876 893546595
1 21605 691956504
36156 56876 422912530
1 56824 45732620
29807 56876 41700656
54143 56876 552243028
...

output:

9462233846885

result:

ok 1 number(s): "9462233846885"

Test #47:

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

input:

57162 64305
46931 30528 48869527
18769 54844 779959453
18160 53152 113933088
28899 42547 990526895
29072 50351 938866111
32493 14667 939834448
1 18004 859828230
51460 11042 724987181
35615 26227 45526415
9728 24379 424981219
54409 8073 734778186
718 21994 280302095
22976 32010 551753851
54253 41421 ...

output:

7129514831426

result:

ok 1 number(s): "7129514831426"

Test #48:

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

input:

48232 48231
46585 21836 297018826
38709 44488 486628813
21630 974 202180077
30420 23620 844687415
30467 24924 42065902
9874 27850 502047607
10114 4219 783225573
35422 22780 35800326
26107 23525 910153413
27307 1934 357233147
39497 38914 639266858
41756 8312 676423198
36030 10376 826091024
35329 2058...

output:

6009662184893

result:

ok 1 number(s): "6009662184893"

Test #49:

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

input:

39301 39312
6449 19088 683150471
10382 17402 418398778
35264 13240 403695984
39048 12510 766846449
33762 1031 695748684
30768 15585 662145042
23423 8347 510667988
34931 6353 379365059
25750 31000 295099892
2495 35895 875621389
19101 10254 781498377
38524 25213 790561894
13683 19202 473578420
21785 2...

output:

4915186436520

result:

ok 1 number(s): "4915186436520"

Test #50:

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

input:

49834 62290
20039 12953 901256183
1 12074 493033464
39761 49834 397245209
21635 49834 177367449
17776 47008 361052744
21748 9268 225960474
27534 39058 24147779
40062 49834 786247289
40625 49834 142725949
45957 8455 900765071
45618 1635 739924761
30381 20960 545031837
12849 13228 383922782
48129 4983...

output:

6245401818970

result:

ok 1 number(s): "6245401818970"

Test #51:

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

input:

40903 81802
1436 40903 332090926
19882 40903 847032499
18314 40903 46013258
19674 40903 406833414
1 4888 924250052
20517 40903 312911733
1 32942 808739435
16253 40903 163667079
1 7026 941541335
1 29186 484629805
18378 40903 567274512
1 6628 671445580
1 24009 347990160
37673 40903 14772628
29199 4090...

output:

6788131862983

result:

ok 1 number(s): "6788131862983"

Test #52:

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

input:

41189 41190
30364 24199 173409961
12472 24207 717710185
9718 19540 447941814
33261 6585 908566213
32868 15591 559707340
32044 13488 899994789
1138 12359 222110885
211 26820 351052629
9615 19779 896455317
32264 30499 878163192
18834 30529 678696942
35960 2486 141880160
31029 40947 55240992
4350 38848...

output:

5156428850715

result:

ok 1 number(s): "5156428850715"

Test #53:

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

input:

41835 45636
27086 15130 509851923
2338 32859 728947190
24099 827 998751878
1 8908 682703936
9258 28274 79425212
7984 12860 800723780
5339 287 67434617
1 12096 985721093
4753 5473 72525920
1947 39101 534187937
22912 157 788703054
3923 16019 914861506
40383 7783 347044911
32161 26013 734456481
28863 1...

output:

5266338379248

result:

ok 1 number(s): "5266338379248"

Test #54:

score: 0
Accepted
time: 42ms
memory: 40500kb

input:

99924 149883
2 3 295027097
1 2 62760769
3 99924 34529034
4 5 120093002
1 4 848462250
5 99924 696807324
6 7 157016311
1 6 98992520
7 99924 912495413
8 9 978933407
1 8 147691102
9 99924 990646745
10 11 654990381
1 10 556864957
11 99924 753235870
12 13 461223967
1 12 415077071
13 99924 308172890
14 15 ...

output:

12489398674704

result:

ok 1 number(s): "12489398674704"

Test #55:

score: 0
Accepted
time: 42ms
memory: 34948kb

input:

99962 149940
2 3 490217
1 2 567938
3 99962 789063
4 5 491499
1 4 469653
5 99962 675353
6 7 617078
1 6 513823
7 99962 968664
8 9 288476
1 8 318155
9 99962 981035
10 11 693214
1 10 767730
11 99962 843585
12 13 807554
1 12 58570
13 99962 962499
14 15 649309
1 14 612023
15 99962 320646
16 17 604333
1 16...

output:

12441577999

result:

ok 1 number(s): "12441577999"

Test #56:

score: 0
Accepted
time: 29ms
memory: 35240kb

input:

99982 149970
2 3 803
1 2 756
3 99982 534
4 5 120
1 4 778
5 99982 739
6 7 19
1 6 428
7 99982 643
8 9 405
1 8 524
9 99982 525
10 11 316
1 10 324
11 99982 997
12 13 897
1 12 846
13 99982 880
14 15 332
1 14 338
15 99982 946
16 17 289
1 16 98
17 99982 749
18 19 606
1 18 701
19 99982 548
20 21 579
1 20 22...

output:

12582906

result:

ok 1 number(s): "12582906"

Test #57:

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

input:

99934 149898
2 3 10
1 2 1
3 99934 9
4 5 5
1 4 6
5 99934 10
6 7 1
1 6 8
7 99934 1
8 9 9
1 8 3
9 99934 8
10 11 7
1 10 10
11 99934 7
12 13 9
1 12 2
13 99934 9
14 15 5
1 14 1
15 99934 6
16 17 8
1 16 8
17 99934 1
18 19 7
1 18 0
19 99934 7
20 21 4
1 20 8
21 99934 2
22 23 8
1 22 8
23 99934 0
24 25 2
1 24 9...

output:

136089

result:

ok 1 number(s): "136089"

Test #58:

score: 0
Accepted
time: 43ms
memory: 38104kb

input:

99976 149961
2 3 1
1 2 0
3 99976 1
4 5 1
1 4 1
5 99976 1
6 7 0
1 6 0
7 99976 1
8 9 0
1 8 0
9 99976 0
10 11 0
1 10 1
11 99976 1
12 13 0
1 12 0
13 99976 0
14 15 1
1 14 1
15 99976 0
16 17 1
1 16 0
17 99976 0
18 19 1
1 18 1
19 99976 1
20 21 1
1 20 1
21 99976 0
22 23 0
1 22 0
23 99976 1
24 25 1
1 24 1
25...

output:

18742

result:

ok 1 number(s): "18742"

Test #59:

score: 0
Accepted
time: 45ms
memory: 35172kb

input:

99938 149904
2 3 0
1 2 0
3 99938 0
4 5 0
1 4 0
5 99938 0
6 7 0
1 6 0
7 99938 0
8 9 0
1 8 0
9 99938 0
10 11 0
1 10 0
11 99938 0
12 13 0
1 12 0
13 99938 0
14 15 0
1 14 0
15 99938 0
16 17 0
1 16 0
17 99938 0
18 19 0
1 18 0
19 99938 0
20 21 0
1 20 0
21 99938 0
22 23 0
1 22 0
23 99938 0
24 25 0
1 24 0
25...

output:

0

result:

ok 1 number(s): "0"

Test #60:

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

input:

99926 124905
2 3 537635990
3 4 886630138
4 5 391957147
1 2 428847815
5 99926 536517469
6 7 19947206
7 8 728537613
8 9 455183942
1 6 744804287
9 99926 296626226
10 11 788071983
11 12 691384895
12 13 574462468
1 10 343356540
13 99926 116211108
14 15 45736946
15 16 602620860
16 17 103567512
1 14 513437...

output:

12523085512536

result:

ok 1 number(s): "12523085512536"

Test #61:

score: 0
Accepted
time: 40ms
memory: 37552kb

input:

99977 119970
2 3 990722193
3 4 482862931
4 5 533856739
5 6 120039686
1 2 64843188
6 99977 492564305
7 8 535032862
8 9 928246946
9 10 902805897
10 11 455472635
1 7 681891351
11 99977 357455859
12 13 54933109
13 14 31569623
14 15 371327655
15 16 874807901
1 12 343876400
16 99977 333046578
17 18 544473...

output:

12828201231548

result:

ok 1 number(s): "12828201231548"

Test #62:

score: 0
Accepted
time: 39ms
memory: 39960kb

input:

99930 112419
2 3 317821068
3 4 829336165
4 5 664588224
5 6 119986369
6 7 912627908
7 8 919725068
8 9 618082121
1 2 536163006
9 99930 114454744
10 11 932011864
11 12 142462672
12 13 92861193
13 14 159908545
14 15 211306998
15 16 620823222
16 17 362020761
1 10 977708437
17 99930 357920267
18 19 617976...

output:

12527346699468

result:

ok 1 number(s): "12527346699468"

Test #63:

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

input:

99906 106148
2 3 609849755
3 4 106884047
4 5 350165292
5 6 91919813
6 7 209831363
7 8 917217019
8 9 7134527
9 10 826476440
10 11 347226029
11 12 122734227
12 13 870185841
13 14 655626851
14 15 889449236
15 16 400472424
16 17 335617843
1 2 800619671
17 99906 405524829
18 19 594570725
19 20 485578839
...

output:

12510185995816

result:

ok 1 number(s): "12510185995816"

Test #64:

score: 0
Accepted
time: 39ms
memory: 35108kb

input:

99906 103026
2 3 686369239
3 4 934282517
4 5 565274307
5 6 3869906
6 7 389684019
7 8 539482102
8 9 712952597
9 10 316713849
10 11 259740173
11 12 221055168
12 13 257473747
13 14 399755785
14 15 928477291
15 16 370567440
16 17 642305162
17 18 288268961
18 19 895025352
19 20 696030405
20 21 251632823
...

output:

12480863570768

result:

ok 1 number(s): "12480863570768"

Test #65:

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

input:

99906 101465
2 3 714034975
3 4 639301727
4 5 285716337
5 6 422290399
6 7 338054951
7 8 756129793
8 9 993219656
9 10 451446321
10 11 326343108
11 12 233671380
12 13 547186987
13 14 408836367
14 15 263925978
15 16 782723455
16 17 1116976
17 18 283714306
18 19 600563863
19 20 939863828
20 21 722409516
...

output:

12483119900651

result:

ok 1 number(s): "12483119900651"

Test #66:

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

input:

99970 100749
2 3 699753467
3 4 964124987
4 5 854977792
5 6 308371078
6 7 383070795
7 8 71720049
8 9 713488277
9 10 897281786
10 11 934845216
11 12 814282104
12 13 338016682
13 14 917265271
14 15 966331501
15 16 419584429
16 17 146092717
17 18 573800974
18 19 230475089
19 20 344278158
20 21 49202967
...

output:

12497816161416

result:

ok 1 number(s): "12497816161416"

Test #67:

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

input:

99842 100230
2 3 174870699
3 4 236933981
4 5 920351688
5 6 563978737
6 7 132981096
7 8 785019712
8 9 987339247
9 10 740440584
10 11 495676811
11 12 306670410
12 13 308006417
13 14 710372904
14 15 151049098
15 16 145277604
16 17 197959591
17 18 362814264
18 19 126841579
19 20 691922422
20 21 14716418...

output:

12490061601021

result:

ok 1 number(s): "12490061601021"

Test #68:

score: 0
Accepted
time: 35ms
memory: 34240kb

input:

99842 100035
2 3 27749730
3 4 285506394
4 5 377219818
5 6 883043826
6 7 514330380
7 8 30445460
8 9 556454840
9 10 917404474
10 11 79705574
11 12 33039157
12 13 837067649
13 14 827694283
14 15 906457546
15 16 145699056
16 17 336623109
17 18 514721425
18 19 605226343
19 20 809745050
20 21 538078968
21...

output:

12488063071414

result:

ok 1 number(s): "12488063071414"

Test #69:

score: 0
Accepted
time: 35ms
memory: 34304kb

input:

99002 99099
2 3 746394008
3 4 168244825
4 5 42875711
5 6 812098009
6 7 250028582
7 8 420505497
8 9 964013149
9 10 964945497
10 11 336577400
11 12 357717858
12 13 190022256
13 14 883751479
14 15 794845626
15 16 668291352
16 17 666867849
17 18 380001101
18 19 344648920
19 20 275853684
20 21 937792092
...

output:

12377885008077

result:

ok 1 number(s): "12377885008077"

Test #70:

score: 0
Accepted
time: 35ms
memory: 33604kb

input:

98002 98049
2 3 4697209
3 4 117147579
4 5 549452743
5 6 295112264
6 7 252897227
7 8 533888676
8 9 581403141
9 10 253511443
10 11 224165288
11 12 855306204
12 13 762824873
13 14 11690435
14 15 213868363
15 16 221424713
16 17 568834401
17 18 369844213
18 19 690773382
19 20 573470175
20 21 531068252
21...

output:

12303335125376

result:

ok 1 number(s): "12303335125376"

Test #71:

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

input:

96002 96024
2 3 332576559
3 4 899854964
4 5 447508683
5 6 777446430
6 7 848569099
7 8 497847474
8 9 447586906
9 10 830643338
10 11 957871867
11 12 596984801
12 13 203397397
13 14 299728080
14 15 125542765
15 16 959095219
16 17 299138578
17 18 603028532
18 19 88055013
19 20 610928305
20 21 127685989
...

output:

11995020992576

result:

ok 1 number(s): "11995020992576"

Test #72:

score: 0
Accepted
time: 35ms
memory: 35692kb

input:

96002 96012
2 3 135593113
3 4 580367856
4 5 63751394
5 6 815743690
6 7 376349331
7 8 278507213
8 9 811358217
9 10 58536052
10 11 835350439
11 12 711745774
12 13 84542447
13 14 433578221
14 15 875262642
15 16 803032448
16 17 243441276
17 18 700800951
18 19 251214496
19 20 317248344
20 21 615888757
21...

output:

12020417933962

result:

ok 1 number(s): "12020417933962"

Test #73:

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

input:

96002 96006
2 3 214185914
3 4 996142105
4 5 861782167
5 6 704175701
6 7 314204670
7 8 746063101
8 9 42398384
9 10 243115815
10 11 514282102
11 12 963492305
12 13 632067576
13 14 175011798
14 15 777185925
15 16 181066580
16 17 316144526
17 18 115179991
18 19 462121215
19 20 410095780
20 21 545906186
...

output:

11999263113600

result:

ok 1 number(s): "11999263113600"

Test #74:

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

input:

96002 96003
2 3 400001252
3 4 403045662
4 5 638627383
5 6 283985616
6 7 357945739
7 8 616562075
8 9 847372437
9 10 332915919
10 11 350813338
11 12 180873260
12 13 80460029
13 14 122620532
14 15 95473995
15 16 995271259
16 17 338047253
17 18 812802195
18 19 434663805
19 20 132356850
20 21 174727357
2...

output:

11991430310474

result:

ok 1 number(s): "11991430310474"

Test #75:

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

input:

96002 96003
2 3 333063
3 4 7161
4 5 135564
5 6 281481
6 7 673160
7 8 815657
8 9 348384
9 10 497732
10 11 745129
11 12 611795
12 13 628448
13 14 25578
14 15 471959
15 16 74696
16 17 304201
17 18 756348
18 19 437834
19 20 877477
20 21 508492
21 22 593234
22 23 116042
23 24 24489
24 25 304124
25 26 310...

output:

11985225975

result:

ok 1 number(s): "11985225975"

Test #76:

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

input:

96002 96003
2 3 396
3 4 4
4 5 866
5 6 17
6 7 353
7 8 212
8 9 285
9 10 944
10 11 560
11 12 485
12 13 614
13 14 960
14 15 432
15 16 415
16 17 323
17 18 78
18 19 178
19 20 426
20 21 713
21 22 124
22 23 935
23 24 273
24 25 505
25 26 162
26 27 45
27 28 347
28 29 436
29 30 338
30 31 450
31 32 510
32 33 31...

output:

12033369

result:

ok 1 number(s): "12033369"

Test #77:

score: 0
Accepted
time: 29ms
memory: 33720kb

input:

96002 96003
2 3 7
3 4 1
4 5 5
5 6 0
6 7 9
7 8 2
8 9 5
9 10 10
10 11 4
11 12 3
12 13 6
13 14 4
14 15 6
15 16 4
16 17 10
17 18 2
18 19 1
19 20 8
20 21 5
21 22 4
22 23 0
23 24 8
24 25 4
25 26 1
26 27 7
27 28 10
28 29 3
29 30 10
30 31 5
31 32 4
32 33 9
33 34 0
34 35 6
35 36 2
36 37 0
37 38 5
38 39 10
39...

output:

130792

result:

ok 1 number(s): "130792"

Test #78:

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

input:

96002 96003
2 3 0
3 4 0
4 5 1
5 6 1
6 7 1
7 8 0
8 9 1
9 10 0
10 11 0
11 12 0
12 13 1
13 14 1
14 15 1
15 16 0
16 17 0
17 18 0
18 19 1
19 20 0
20 21 1
21 22 1
22 23 1
23 24 0
24 25 0
25 26 1
26 27 1
27 28 1
28 29 0
29 30 1
30 31 0
31 32 1
32 33 1
33 34 0
34 35 0
35 36 0
36 37 0
37 38 0
38 39 1
39 40 1...

output:

15990

result:

ok 1 number(s): "15990"

Test #79:

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

input:

96002 96003
2 3 0
3 4 0
4 5 0
5 6 0
6 7 0
7 8 0
8 9 0
9 10 0
10 11 0
11 12 0
12 13 0
13 14 0
14 15 0
15 16 0
16 17 0
17 18 0
18 19 0
19 20 0
20 21 0
21 22 0
22 23 0
23 24 0
24 25 0
25 26 0
26 27 0
27 28 0
28 29 0
29 30 0
30 31 0
31 32 0
32 33 0
33 34 0
34 35 0
35 36 0
36 37 0
37 38 0
38 39 0
39 40 0...

output:

0

result:

ok 1 number(s): "0"