QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#208658#2065. Cyclic DistancenjwrzAC ✓157ms56072kbC++202.0kb2023-10-09 19:45:562023-10-09 19:45:56

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 22664kb

input:

1
5 3
1 2 4
1 3 1
1 4 8
4 5 9

output:

44

result:

ok single line: '44'

Test #2:

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

input:

57206
3 2
1 2 574927
2 3 406566
2 2
1 2 308806
4 3
1 2 312588
2 3 500141
2 4 53602
3 3
1 2 797183
2 3 944061
5 3
1 2 624010
2 3 488613
3 4 734514
4 5 497493
5 4
1 2 540278
2 3 488655
2 4 228989
2 5 653896
2 2
1 2 569117
4 2
1 2 821764
2 3 499471
1 4 549060
2 2
1 2 991159
2 2
1 2 482941
5 4
1 2 30462...

output:

1962986
617612
1732662
3482488
4689260
3823636
1138234
3740590
1982318
965882
3418504
5026562
1623414
1885106
1952142
3050630
1691896
3102076
2380932
3076270
5697196
7258020
879020
2500212
3613854
1358950
1182198
2273662
2331560
1681964
8917452
2373066
3163042
3104226
3642898
3162310
5058442
3669186...

result:

ok 57206 lines

Test #3:

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

input:

57087
3 3
1 2 34132
1 3 188096
2 2
1 2 996527
2 2
1 2 475736
5 3
1 2 329834
2 3 339687
1 4 954113
4 5 224354
2 2
1 2 641444
2 2
1 2 114059
5 3
1 2 635722
1 3 552627
1 4 721758
3 5 396156
4 3
1 2 655099
2 3 963393
1 4 953969
5 2
1 2 369719
1 3 22087
1 4 531252
3 5 449025
4 3
1 2 788498
1 3 220292
1 4...

output:

444456
1993054
951472
3695976
1282888
228118
4612526
5144922
2004728
3309502
2626844
3053048
3939444
3790784
2617770
38866
3033250
5707738
511666
403846
1923106
3331606
3447180
2329518
5656124
33582
2283312
3454982
110590
3125394
4517486
4522330
2352316
3966810
3463746
5181112
3089346
1260326
466418...

result:

ok 57087 lines

Test #4:

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

input:

33344
9 6
1 2 562996
1 3 312637
3 4 591016
1 5 811983
2 6 896220
3 7 854379
2 8 861166
1 9 672337
8 6
1 2 53530
1 3 712638
1 4 539356
1 5 179377
3 6 456495
2 7 730760
4 8 934379
3 3
1 2 87024
1 3 328551
3 3
1 2 664600
1 3 519786
5 4
1 2 374521
1 3 484148
2 4 501378
1 5 280691
10 3
1 2 676949
1 3 639...

output:

12876734
9717058
831150
2368772
4030518
7963678
2135868
739728
11584454
1670128
3432160
5573124
1293282
3608364
8574290
6242670
10860048
4726106
5661430
9713590
5160212
5958260
14418122
1913782
1393854
5129544
9369494
11601220
4751232
1623938
8259790
3591252
5112182
4761950
5284034
13000192
4895040
...

result:

ok 33344 lines

Test #5:

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

input:

33337
8 2
1 2 22201
2 3 94167
2 4 978398
4 5 452870
5 6 59368
5 7 804913
7 8 977938
3 3
1 2 784938
1 3 333822
8 4
1 2 737256
2 3 276599
2 4 338826
2 5 260533
2 6 520885
1 7 971939
1 8 613926
8 2
1 2 405702
1 3 514900
2 4 861432
2 5 715573
2 6 269555
5 7 528278
6 8 537996
6 2
1 2 984398
2 3 629
1 4 3...

output:

6616572
2237520
7840176
4328906
4093536
11035562
2053254
17920138
4892406
11437574
7585262
5318412
12387008
1823170
5912732
2056136
4049368
3780958
3965658
1661392
3447138
7906552
12728830
12419926
4593330
817758
2300052
12252582
10429848
629344
8615656
8922918
3351270
6102888
3501718
11662020
15460...

result:

ok 33337 lines

Test #6:

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

input:

18261
6 6
1 2 401169
1 3 865631
3 4 470224
1 5 136374
3 6 696999
3 2
1 2 216465
2 3 99004
9 3
1 2 360514
1 3 110584
3 4 170236
1 5 969734
4 6 929592
3 7 907150
4 8 418707
4 9 357462
4 4
1 2 951855
2 3 70272
2 4 113663
17 9
1 2 352392
1 3 254146
2 4 362317
1 5 589664
3 6 284236
6 7 978987
2 8 122649
...

output:

8603318
630938
6174592
2271580
32450770
9765552
9941290
17849770
6762442
9904414
59511294
4686354
5194544
44718814
20540916
7002622
29096312
1815140
9151006
20865960
2859444
7971376
15607738
16938982
9282678
15770664
10404176
2332096
3515930
50580870
9444474
7316680
3747306
14809566
32347198
5442322...

result:

ok 18261 lines

Test #7:

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

input:

18082
12 8
1 2 893078
2 3 422969
1 4 633414
4 5 744557
3 6 860147
3 7 385978
5 8 399366
3 9 431676
4 10 181291
9 11 486224
10 12 444565
13 12
1 2 449428
1 3 484947
3 4 581713
3 5 159778
3 6 337685
4 7 565917
4 8 136883
7 9 963963
9 10 457061
9 11 818966
4 12 588294
1 13 275051
11 8
1 2 742103
1 3 98...

output:

26178344
26647644
17726444
51096468
51024750
4318098
10947660
9534678
3065408
11342084
8694638
19155222
849062
7555504
8993018
3193064
4338758
519680
4516496
18892576
2929566
12021588
29857614
40051924
1688342
24734948
10330762
14820592
11122894
15774626
17385606
20569180
5715160
3895974
7010784
271...

result:

ok 18082 lines

Test #8:

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

input:

7777
27 19
1 2 930838
1 3 462030
1 4 982798
2 5 829904
3 6 593202
5 7 941278
5 8 694251
3 9 720130
4 10 604740
4 11 550251
5 12 409519
3 13 23594
12 14 54526
2 15 511926
1 16 48491
1 17 765416
12 18 819984
9 19 325056
7 20 175920
11 21 269086
16 22 641837
13 23 1737
21 24 948879
15 25 349036
3 26 13...

output:

71370146
30838976
80456148
32228866
5055546
25592662
95173582
13955400
17980860
19738002
78673788
101336458
125780830
1081414
105831712
11260058
85123024
74738088
91760570
127445888
56551920
26076342
50784456
43425188
9465296
64841258
21733114
12894954
66549458
57289112
46556192
46428776
79922806
15...

result:

ok 7777 lines

Test #9:

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

input:

3973
72 55
1 2 918907
2 3 400804
2 4 72269
2 5 254465
3 6 176834
4 7 487004
4 8 469111
5 9 299565
5 10 455772
8 11 575420
3 12 538035
7 13 501415
11 14 583573
1 15 879841
11 16 16749
16 17 48301
17 18 5050
6 19 739687
10 20 264146
19 21 95867
14 22 436314
18 23 109932
17 24 472782
5 25 809039
19 26 ...

output:

201634460
8298172
194453968
102456878
21539194
126399884
235528270
117959738
23543328
41025942
8304998
31545014
17344164
41189444
25956190
46294310
13019524
71670116
120980628
48791074
150100762
116919430
244037610
218464668
133368300
255723622
106123038
244888064
19329892
66580624
74085138
26108538...

result:

ok 3973 lines

Test #10:

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

input:

1977
164 159
1 2 789785
2 3 953798
2 4 694582
2 5 546152
1 6 977613
4 7 100774
1 8 699051
6 9 456494
4 10 736064
8 11 451475
2 12 212640
12 13 472011
2 14 473796
12 15 986991
8 16 723782
6 17 209086
2 18 619112
15 19 740890
19 20 114446
4 21 470217
7 22 718655
9 23 989557
14 24 575144
24 25 897325
1...

output:

728347768
385840768
77551442
592321810
379244468
70306600
40298184
752175314
115213140
20514164
76134366
99658306
453129018
233705740
297458016
274605942
332890648
11997344
319596032
85455912
55983850
11837114
356411436
56917200
180309026
69088440
113716684
159826434
571011208
528906534
606746358
46...

result:

ok 1977 lines

Test #11:

score: 0
Accepted
time: 62ms
memory: 23004kb

input:

818
216 206
1 2 369713
2 3 421291
3 4 140720
3 5 453918
2 6 347245
3 7 292355
4 8 804550
2 9 511603
5 10 576941
6 11 79641
2 12 493352
6 13 192308
12 14 854864
4 15 144922
7 16 522578
7 17 532656
15 18 685489
2 19 809906
14 20 599938
20 21 527857
10 22 822574
4 23 885328
13 24 111539
8 25 292999
10 ...

output:

867774932
2296994794
233491416
339174870
4380454
316249010
1649235398
150692978
859452362
1387824632
566645160
1671550174
374729794
38076864
256942076
89728496
111087726
819481720
353274342
158202878
2507683982
659900622
594449324
108828820
220100714
806438160
288755872
450110446
1306416876
28801645...

result:

ok 818 lines

Test #12:

score: 0
Accepted
time: 60ms
memory: 25556kb

input:

388
885 741
1 2 614111
1 3 646996
1 4 731680
3 5 509182
2 6 712870
2 7 477522
1 8 799038
2 9 526704
4 10 88823
6 11 585078
8 12 900068
12 13 440908
6 14 388379
2 15 812954
5 16 917816
2 17 727629
5 18 241307
18 19 529750
2 20 809637
4 21 266090
4 22 413888
4 23 465987
19 24 643732
3 25 848861
7 26 3...

output:

5165240612
3991064320
300206776
2363897270
4350064382
2904490770
1259900728
451154248
2752947084
1151013030
207016404
703014190
4827032982
47085678
465899304
559318078
208644530
1259221796
315251532
3807613878
865302402
339449112
3285190350
379703410
1086628014
194369296
2706984676
9377868
152376728...

result:

ok 388 lines

Test #13:

score: 0
Accepted
time: 76ms
memory: 26748kb

input:

124
806 542
1 2 394915
2 3 762809
2 4 71615
4 5 901682
1 6 28248
1 7 325984
1 8 161160
7 9 70782
1 10 349322
7 11 654826
11 12 427646
10 13 517990
12 14 400553
3 15 598040
8 16 253298
10 17 294666
14 18 613927
13 19 625834
17 20 93238
4 21 45963
9 22 870452
11 23 376547
19 24 659738
5 25 739083
17 2...

output:

3807793034
1343227424
37609802
3705549364
126733756
9635178252
3506210498
16987523222
22763236
7093402608
10108316194
1798434742
2332283402
110619882
12311189932
7785591236
2331817838
7321850968
10330012804
4659673742
1598549982
3471432852
9127534748
6077191920
2755494906
82670438
792532856
59178738...

result:

ok 124 lines

Test #14:

score: 0
Accepted
time: 86ms
memory: 30156kb

input:

47
4196 3473
1 2 59765
1 3 28405
2 4 95437
1 5 426251
4 6 680053
4 7 875644
3 8 101616
2 9 669879
4 10 527801
9 11 696926
4 12 955771
6 13 953289
6 14 899927
2 15 309441
1 16 791394
11 17 990342
2 18 921444
17 19 407114
18 20 895642
12 21 733300
19 22 714292
5 23 177566
1 24 874904
18 25 425752
21 2...

output:

32935676304
3717064448
37360311556
32857937108
25425748172
20991814086
9308076718
30002956630
25990649392
35230149484
30166498052
6980464444
848691918
727066270
19184659230
21879371990
11886363268
7281096728
34529212140
33573011954
29329416654
10604037682
14609919178
7088000188
2997249588
2182193162...

result:

ok 47 lines

Test #15:

score: 0
Accepted
time: 106ms
memory: 32108kb

input:

25
13266 5290
1 2 398633
2 3 578977
1 4 568699
2 5 495651
1 6 356927
4 7 884995
5 8 465219
3 9 54537
4 10 989480
4 11 212881
8 12 576100
3 13 519498
7 14 209089
2 15 119352
15 16 440028
6 17 11442
17 18 142375
12 19 93668
18 20 569575
6 21 634959
14 22 921078
18 23 749636
15 24 78850
20 25 631085
18...

output:

57636699686
20776112106
22411104826
41387716460
99873948690
23234934704
26640137916
49381353188
93899141028
180822788490
16939309804
118325463046
65282343804
88479211840
109851741390
2732988616
36278698716
1584258300
6631320784
890513562
75812804
12914508
1164298
3956432
1036116

result:

ok 25 lines

Test #16:

score: 0
Accepted
time: 119ms
memory: 38148kb

input:

13
31190 2158
1 2 781853
2 3 614702
3 4 680885
1 5 519959
1 6 743821
1 7 498955
3 8 436452
6 9 426284
3 10 74654
4 11 20992
10 12 967749
4 13 324721
11 14 442563
5 15 661646
5 16 853352
11 17 766216
3 18 731178
9 19 754550
1 20 636192
18 21 139985
18 22 532871
21 23 341305
11 24 138046
21 25 255022
...

output:

35215118232
55749095234
253652245940
236318456986
22259296024
5904204406
3347768326
11182269610
653683538
323715442
4623062
21020532
4497448

result:

ok 13 lines

Test #17:

score: 0
Accepted
time: 121ms
memory: 37252kb

input:

11
23148 11569
1 2 814559
1 3 529617
2 4 169569
2 5 291868
2 6 141363
6 7 208623
6 8 970146
7 9 264414
1 10 460715
7 11 922739
3 12 247233
11 13 463914
11 14 930506
12 15 890547
3 16 98019
1 17 318068
8 18 907736
8 19 575428
9 20 267180
17 21 664753
1 22 233687
16 23 664123
20 24 480003
5 25 316247
...

output:

131403496778
437083768410
29036758090
162514613074
1459900026
57667303102
27192563612
167378465122
324860400
9073270
2801740

result:

ok 11 lines

Test #18:

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

input:

33344
9 6
1 2 562996
1 3 312637
3 4 591016
1 5 811983
2 6 896220
4 7 854379
5 8 861166
4 9 672337
8 6
1 2 53530
1 3 712638
1 4 539356
1 5 179377
3 6 456495
4 7 730760
6 8 934379
3 3
1 2 87024
1 3 328551
3 3
1 2 664600
1 3 519786
5 4
1 2 374521
1 3 484148
2 4 501378
1 5 280691
10 3
1 2 676949
1 3 639...

output:

16364046
11948264
831150
2368772
4030518
8718520
2135868
739728
17887112
1670128
3432160
5573124
1293282
3608364
9786762
6242670
10860048
4629338
5661430
10201260
5160212
5927214
13871014
1913782
1393854
4800470
8646754
13014822
4751232
1623938
9138792
3591252
5112182
4761950
4586032
12082886
519797...

result:

ok 33344 lines

Test #19:

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

input:

33337
8 2
1 2 22201
2 3 94167
2 4 978398
4 5 452870
5 6 59368
3 7 804913
4 8 977938
3 3
1 2 784938
1 3 333822
8 4
1 2 737256
2 3 276599
2 4 338826
2 5 260533
2 6 520885
3 7 971939
4 8 613926
8 2
1 2 405702
1 3 514900
2 4 861432
2 5 715573
2 6 269555
6 7 528278
3 8 537996
6 2
1 2 984398
2 3 629
1 4 3...

output:

5710832
2237520
6918862
4640060
4093536
11124574
2053254
13791458
4237112
10302280
7585262
5318412
11661146
1823170
5912732
2056136
4049368
3780958
3965658
1661392
3447138
6521186
13822322
14297984
5139694
817758
2300052
12441972
12131080
629344
10222176
9904156
3530164
6102888
3501718
14897866
1602...

result:

ok 33337 lines

Test #20:

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

input:

18261
6 6
1 2 401169
1 3 865631
3 4 470224
1 5 136374
3 6 696999
3 2
1 2 216465
2 3 99004
9 3
1 2 360514
1 3 110584
3 4 170236
1 5 969734
4 6 929592
3 7 907150
6 8 418707
8 9 357462
4 4
1 2 951855
2 3 70272
2 4 113663
17 9
1 2 352392
1 3 254146
2 4 362317
1 5 589664
3 6 284236
2 7 978987
7 8 122649
...

output:

8603318
630938
7726930
2271580
39511914
9291560
9322562
18891490
6762442
11282728
45981248
4686354
6204500
33805266
29050944
7002622
27812476
1815140
8291966
28949776
2859444
7971376
19995250
14927176
10794868
16032466
8113806
2332096
3515930
30566568
11171378
7316680
3747306
15622598
46200820
75783...

result:

ok 18261 lines

Test #21:

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

input:

18082
12 8
1 2 893078
2 3 422969
1 4 633414
4 5 744557
3 6 860147
2 7 385978
7 8 399366
4 9 431676
9 10 181291
9 11 486224
11 12 444565
13 12
1 2 449428
1 3 484947
3 4 581713
3 5 159778
3 6 337685
6 7 565917
5 8 136883
8 9 963963
6 10 457061
9 11 818966
8 12 588294
12 13 275051
11 8
1 2 742103
1 3 9...

output:

25242528
19757364
27007054
55240682
86564840
4085192
18139318
9534678
3065408
12744226
7727820
19949556
849062
8241740
11906226
3193064
4338758
519680
4071722
16300002
2929566
16428948
23453358
40860624
1688342
24721740
11410636
17290986
13878788
21750284
18940876
29581306
5715160
3895974
8886486
27...

result:

ok 18082 lines

Test #22:

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

input:

7777
27 19
1 2 930838
1 3 462030
1 4 982798
2 5 829904
3 6 593202
3 7 941278
6 8 694251
6 9 720130
9 10 604740
9 11 550251
7 12 409519
9 13 23594
11 14 54526
10 15 511926
11 16 48491
14 17 765416
14 18 819984
15 19 325056
16 20 175920
16 21 269086
18 22 641837
22 23 1737
19 24 948879
21 25 349036
23...

output:

75228170
57649698
132133658
33869456
5055546
40187600
238142214
19019330
21052956
15867730
111296070
143396510
178896852
1081414
241828026
16808758
166238356
132779414
158171092
309062484
72050812
29444440
119894362
63427714
7982906
173052228
32140652
15853058
181352856
104599994
59113664
91137016
1...

result:

ok 7777 lines

Test #23:

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

input:

3973
72 55
1 2 918907
2 3 400804
2 4 72269
2 5 254465
3 6 176834
5 7 487004
6 8 469111
7 9 299565
8 10 455772
8 11 575420
11 12 538035
10 13 501415
13 14 583573
10 15 879841
11 16 16749
16 17 48301
15 18 5050
14 19 739687
19 20 264146
19 21 95867
19 22 436314
22 23 109932
22 24 472782
24 25 809039
2...

output:

550802140
9430612
543389458
132607198
33518502
286156830
631371590
247716594
23612752
47668732
8304998
35618886
17797666
54996198
38216132
66312258
18311866
146893642
239261316
83215660
489394056
212729892
679954418
390831710
289311584
550398988
232201858
522438480
27156366
145913756
138648040
78355...

result:

ok 3973 lines

Test #24:

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

input:

1977
164 159
1 2 789785
2 3 953798
2 4 694582
2 5 546152
1 6 977613
2 7 100774
3 8 699051
4 9 456494
6 10 736064
8 11 451475
11 12 212640
8 13 472011
10 14 473796
13 15 986991
13 16 723782
12 17 209086
17 18 619112
18 19 740890
16 20 114446
19 21 470217
19 22 718655
22 23 989557
23 24 575144
24 25 8...

output:

2709804252
1073382686
146182876
2597928172
1039083688
130202922
44807718
2697948818
275515666
45003232
249922510
130302328
2233680240
576739142
1323701390
594678858
812802376
11830192
982876590
114228054
118682940
13448660
763467086
95466686
771594172
135505534
236009214
251246628
2419143104
1720022...

result:

ok 1977 lines

Test #25:

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

input:

818
216 206
1 2 369713
2 3 421291
3 4 140720
3 5 453918
2 6 347245
6 7 292355
7 8 804550
6 9 511603
7 10 576941
6 11 79641
11 12 493352
10 13 192308
11 14 854864
10 15 144922
12 16 522578
14 17 532656
14 18 685489
15 19 809906
17 20 599938
20 21 527857
18 22 822574
22 23 885328
19 24 111539
21 25 29...

output:

4423750216
19666685454
693546124
1218864536
4380454
1447915712
11002456676
506224456
5030664554
11273572258
2955101958
15029178348
775193614
105634972
1570657002
174010602
402583934
4831109418
757286726
211417032
17891846444
3889435970
2672696626
280579862
598159250
6733598614
1154119398
1167341254
...

result:

ok 818 lines

Test #26:

score: 0
Accepted
time: 57ms
memory: 26104kb

input:

388
885 741
1 2 614111
1 3 646996
1 4 731680
3 5 509182
2 6 712870
3 7 477522
3 8 799038
8 9 526704
7 10 88823
6 11 585078
8 12 900068
12 13 440908
13 14 388379
11 15 812954
15 16 917816
13 17 727629
17 18 241307
18 19 529750
16 20 809637
19 21 266090
19 22 413888
20 23 465987
19 24 643732
21 25 848...

output:

59885814774
50002653154
1816966352
17291950154
60032231098
35122321576
7267828716
1308307132
28075201798
12526928294
1852930634
3350761620
66628385514
66676096
904923322
6492445224
537436282
6796359008
772676382
51098682222
10346684906
1614190620
36290697118
1210792144
8736409274
1024153808
26720699...

result:

ok 388 lines

Test #27:

score: 0
Accepted
time: 57ms
memory: 26820kb

input:

124
806 542
1 2 394915
2 3 762809
2 4 71615
4 5 901682
1 6 28248
4 7 325984
3 8 161160
8 9 70782
6 10 349322
7 11 654826
9 12 427646
12 13 517990
13 14 400553
11 15 598040
13 16 253298
16 17 294666
14 18 613927
17 19 625834
18 20 93238
19 21 45963
18 22 870452
19 23 376547
22 24 659738
20 25 739083
...

output:

48936408094
17471908120
54454776
53918382924
3519408202
288476487472
42125063784
622125671858
30246510
272412947860
338801986588
18362649738
60111911056
295556944
401876125448
160437458796
49896147754
122911217026
280614077856
129343717826
59504034812
111545644048
208657339784
126942483030
386623113...

result:

ok 124 lines

Test #28:

score: 0
Accepted
time: 59ms
memory: 27944kb

input:

47
4196 3473
1 2 59765
1 3 28405
2 4 95437
1 5 426251
4 6 680053
4 7 875644
7 8 101616
5 9 669879
5 10 527801
9 11 696926
11 12 955771
10 13 953289
10 14 899927
12 15 309441
11 16 791394
16 17 990342
13 18 921444
14 19 407114
15 20 895642
17 21 733300
17 22 714292
22 23 177566
22 24 874904
24 25 425...

output:

1468399285244
102200696034
3238428683778
2643474453344
901036267884
1972786091840
417099930256
2761920427202
857183872178
2322433328892
2941758404530
156061938168
11253131368
11802317450
1094829501444
856744931620
1304028636266
110113045294
3971200381846
4475773249254
1834941427340
567531049564
8722...

result:

ok 47 lines

Test #29:

score: 0
Accepted
time: 63ms
memory: 30160kb

input:

25
13266 5290
1 2 398633
2 3 578977
1 4 568699
2 5 495651
1 6 356927
2 7 884995
3 8 465219
5 9 54537
5 10 989480
9 11 212881
7 12 576100
9 13 519498
10 14 209089
10 15 119352
15 16 440028
12 17 11442
13 18 142375
15 19 93668
15 20 569575
16 21 634959
18 22 921078
18 23 749636
22 24 78850
24 25 63108...

output:

9429107881142
1167496275868
2183321020318
2820431327188
18421908430180
2124726020712
2015323342436
8284909961596
18214984883958
44099937371042
937521994806
16841332143752
6150036339072
21763109203904
23836576845124
34117938312
2738239358334
11018252468
89776418094
4681539574
94503164
12990056
116429...

result:

ok 25 lines

Test #30:

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

input:

13
31190 2158
1 2 781853
2 3 614702
3 4 680885
1 5 519959
1 6 743821
5 7 498955
5 8 436452
5 9 426284
8 10 74654
9 11 20992
9 12 967749
10 13 324721
12 14 442563
10 15 661646
15 16 853352
15 17 766216
17 18 731178
15 19 754550
17 20 636192
18 21 139985
20 22 532871
21 23 341305
20 24 138046
23 25 25...

output:

10918634311134
6645821585524
194953063938042
154325284180440
903269446988
238276970566
130597034348
488761291942
3356881414
1030548026
4623062
24048084
4497448

result:

ok 13 lines

Test #31:

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

input:

11
23148 11569
1 2 814559
1 3 529617
2 4 169569
2 5 291868
2 6 141363
4 7 208623
4 8 970146
4 9 264414
5 10 460715
7 11 922739
7 12 247233
8 13 463914
12 14 930506
11 15 890547
13 16 98019
16 17 318068
15 18 907736
17 19 575428
15 20 267180
17 21 664753
18 22 233687
22 23 664123
21 24 480003
22 25 3...

output:

33737441230018
323927790069866
6539163814444
34825571326708
263258490410
9763006562578
1748973188988
21181602150590
1391986980
9073270
2801740

result:

ok 11 lines

Test #32:

score: 0
Accepted
time: 141ms
memory: 55096kb

input:

1
200000 78338
53871 69295 23673
29179 110143 493124
123136 56014 881016
30517 19542 654896
108350 66383 650002
117320 58283 938600
107841 40534 178927
1730 185502 840687
104451 178046 253131
112065 83235 128474
21601 60009 457141
110178 105248 237074
147725 105109 44305
22888 140407 949590
181482 1...

output:

2109052641159144

result:

ok single line: '2109052641159144'

Test #33:

score: 0
Accepted
time: 121ms
memory: 53880kb

input:

1
200000 9538
111395 168369 171524
192366 136500 314344
137814 77497 808616
40774 54991 297789
98875 187739 298921
166846 189487 462423
191292 152734 416768
176744 190150 919759
2631 40654 391303
27454 29855 579684
97138 120635 319552
153910 29292 432568
143606 153709 849167
2655 132692 557265
15490...

output:

310879576613096

result:

ok single line: '310879576613096'

Test #34:

score: 0
Accepted
time: 138ms
memory: 51964kb

input:

1
200000 118279
157488 145119 898897
68273 186753 380824
176719 73307 932620
53643 157867 779971
184005 157453 199843
36547 42247 50652
130405 185134 151831
116405 173764 917487
180608 112158 941920
16940 44722 130429
5277 168558 445223
96744 9117 151099
157570 151335 750860
188934 172034 878737
186...

output:

2768417661726808

result:

ok single line: '2768417661726808'

Test #35:

score: 0
Accepted
time: 136ms
memory: 53328kb

input:

1
200000 49479
189510 128232 658974
156978 53279 671495
72192 56779 248113
17626 70451 196744
147483 196540 909277
15222 115410 863072
165143 56006 886895
44633 46185 658319
188191 116878 716728
156885 88615 489686
142072 101669 379405
163254 112679 902334
181212 32988 587144
198433 118596 167505
13...

output:

1434803560864054

result:

ok single line: '1434803560864054'

Test #36:

score: 0
Accepted
time: 134ms
memory: 52168kb

input:

1
200000 169449
58793 81879 353642
106362 178205 929462
180910 199850 563605
126318 64208 646222
34456 20018 586006
181335 169370 675493
95728 124433 365062
94953 180624 431854
4646 95619 267344
128722 29062 816239
68066 92620 570484
66747 136279 620865
62252 117874 199237
58090 44571 680466
24208 7...

output:

3253375067419374

result:

ok single line: '3253375067419374'

Test #37:

score: 0
Accepted
time: 132ms
memory: 51680kb

input:

1
200000 100649
101102 97388 672993
83837 96394 667952
71971 26340 960438
123234 50416 495929
82507 169502 480046
190461 197756 544685
5220 129736 753191
62791 62225 669847
20566 46574 450551
15023 120392 928501
101670 59345 564710
43493 192548 445114
71262 115411 438065
118638 159059 535693
159944 ...

output:

2502971995935244

result:

ok single line: '2502971995935244'

Test #38:

score: 0
Accepted
time: 148ms
memory: 55108kb

input:

1
200000 9391
40964 135893 53540
83838 109165 903782
195153 23646 661274
191637 108391 491909
19653 32067 725775
145616 193447 693953
119185 148051 865679
95108 19838 885401
130833 92127 162477
147635 22898 894160
113924 180507 129214
77214 135838 389870
120479 128375 859865
16948 131725 308541
1516...

output:

306764248738748

result:

ok single line: '306764248738748'

Test #39:

score: 0
Accepted
time: 130ms
memory: 54908kb

input:

1
200000 140590
141658 195962 716438
94304 146586 401384
123305 69842 172316
5547 87558 105213
163383 27612 487889
39622 76451 714608
191906 997 619029
173317 18815 978168
188272 178202 909467
178371 12654 65892
81731 90978 827115
164000 134810 436821
143452 123148 367329
54647 36366 992065
36024 17...

output:

3039012908946716

result:

ok single line: '3039012908946716'

Test #40:

score: 0
Accepted
time: 137ms
memory: 55672kb

input:

1
200000 71790
43247 116166 638808
69604 179273 755944
63265 120179 221012
42066 93015 218318
40083 167252 160362
157087 169035 137877
190310 96286 385221
179305 18949 140977
4314 184362 271427
20240 175495 166924
58258 121257 295992
87654 117411 80514
95631 168103 336489
147947 171953 52516
20468 5...

output:

1963680908911268

result:

ok single line: '1963680908911268'

Test #41:

score: 0
Accepted
time: 123ms
memory: 52904kb

input:

1
200000 191760
103382 25434 737426
19978 160594 832844
42014 157184 242443
17829 19368 720909
177777 10000 556798
58286 96422 318354
18522 139677 891541
81206 93743 765183
60085 24561 542796
128098 14747 159756
66255 75832 332855
165864 155666 37380
5887 166972 122618
22512 22650 531910
179720 1766...

output:

3326601468284414

result:

ok single line: '3326601468284414'

Test #42:

score: 0
Accepted
time: 157ms
memory: 54148kb

input:

1
200000 22713
39079 76930 313884
119314 151343 433491
21261 116904 998188
191778 176037 322346
52938 10114 727663
121986 43836 166817
190693 56832 124939
20776 124747 319424
103338 45779 416965
180079 134936 298864
6960 88255 697804
136275 869 830783
124311 5353 724014
84834 134413 677792
77559 576...

output:

717001649135198

result:

ok single line: '717001649135198'

Test #43:

score: 0
Accepted
time: 114ms
memory: 54444kb

input:

1
200000 153912
177401 51328 84890
149362 92759 743554
183731 116428 105595
199884 104578 529720
2209 1994 829335
149241 76248 197746
10419 75375 522036
167120 69894 729711
29709 156840 452077
45477 181999 248132
192541 66807 950126
74132 128908 645400
40116 157423 727674
122626 83640 946727
25257 1...

output:

3145280511525984

result:

ok single line: '3145280511525984'

Test #44:

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

input:

1
200000 73883
110234 123244 765572
138235 197546 651766
122911 165763 690493
115495 84714 692251
122664 109377 216738
8871 35856 6676
182061 31965 560525
153133 5104 897633
173705 46733 705345
1110 83981 688034
104606 113528 639839
126007 19895 279390
170635 80960 997810
165028 93444 732096
190073 ...

output:

2002750409553702

result:

ok single line: '2002750409553702'

Test #45:

score: 0
Accepted
time: 133ms
memory: 52324kb

input:

1
200000 193853
70582 73128 961747
160971 5767 380536
119980 119174 246204
75732 17776 969164
114585 176693 216722
12062 110397 988713
26469 125179 562829
45562 103899 424082
120336 161122 956695
32005 196677 840059
161415 67174 832846
186384 19509 317515
65939 13742 479622
71609 169103 559649
15028...

output:

3327421759099712

result:

ok single line: '3327421759099712'

Test #46:

score: 0
Accepted
time: 131ms
memory: 54384kb

input:

1
200000 113824
90117 188964 458474
139119 79500 332014
40291 6497 54420
73202 147329 317783
4954 74959 108002
108264 98945 575710
84007 192346 971852
127390 87467 320276
8135 128371 825948
49942 87866 30941
105491 76693 992052
113524 44557 58869
89001 194057 266118
168293 85922 816361
75252 20548 7...

output:

2720608218055724

result:

ok single line: '2720608218055724'

Test #47:

score: 0
Accepted
time: 137ms
memory: 55880kb

input:

1
200000 45024
74800 120625 262222
82863 83641 831071
66078 154100 562714
37478 28397 42752
34596 57510 495923
155699 126630 492412
184947 87641 419912
193620 39863 348980
83626 41236 789834
155990 154936 474250
121699 115001 613932
24462 42378 201893
183998 5822 174441
63771 118758 10161
100801 637...

output:

1328121504318198

result:

ok single line: '1328121504318198'

Test #48:

score: 0
Accepted
time: 138ms
memory: 52632kb

input:

1
200000 176223
61827 142213 685404
135041 193301 216738
31706 160065 428757
141854 89550 167848
163881 6742 185083
58372 22819 58835
153487 28575 151373
28649 196130 908239
160859 40046 84609
146893 154940 495931
188182 112442 4095
129849 140264 618089
91595 7741 539109
67422 32174 24416
191419 149...

output:

3274084363550724

result:

ok single line: '3274084363550724'

Test #49:

score: 0
Accepted
time: 131ms
memory: 52224kb

input:

1
200000 84965
49033 50746 5059
53390 162127 752613
198394 27145 527422
124180 127450 334259
198446 117582 893386
28430 24037 84441
1971 132908 901311
2664 165514 845528
36420 7862 965931
62993 119860 991207
39579 64576 598287
152969 70389 661745
16184 40828 16221
15491 138338 201173
54223 4506 9317...

output:

2220281694923046

result:

ok single line: '2220281694923046'

Test #50:

score: 0
Accepted
time: 119ms
memory: 54444kb

input:

1
200000 16165
150735 43917 396747
50469 72982 821103
190929 72555 484941
173470 91868 452081
183614 158208 992336
37007 155226 809829
2834 52082 793820
42350 36829 392692
15193 93013 399519
149054 156635 820012
47874 86286 489895
136145 130705 887999
112512 179663 10025
162288 6957 192196
41060 442...

output:

514485869538258

result:

ok single line: '514485869538258'

Test #51:

score: 0
Accepted
time: 130ms
memory: 55440kb

input:

1
200000 136135
38299 159325 835540
83035 30551 414683
98119 29131 665281
161704 103655 521938
131857 197349 224025
70478 134709 697810
171994 26890 108900
47850 133282 889613
125316 193036 785182
50480 76047 328810
150358 68450 332474
47301 172882 127619
51759 197836 434650
90689 6945 52903
6846 18...

output:

2993082728870324

result:

ok single line: '2993082728870324'

Test #52:

score: 0
Accepted
time: 135ms
memory: 53772kb

input:

1
200000 166424
183387 117367 289932
17407 136821 93675
144408 167410 629376
165626 159373 850265
75174 179380 674917
140944 34681 134767
162468 198249 462727
168454 28620 907649
11826 190070 675555
142054 162258 645977
10932 13591 542636
188990 178024 17395
93198 119107 309897
176632 52727 376447
1...

output:

3261950838600148

result:

ok single line: '3261950838600148'

Test #53:

score: 0
Accepted
time: 122ms
memory: 53412kb

input:

1
200000 97625
81107 49993 21689
104061 184013 441518
169890 132692 897910
8677 24117 326908
104156 105930 670898
31972 145354 347791
92295 25822 355099
154625 64169 20138
103617 154142 891109
174720 66736 582096
35331 88700 284103
28719 144089 357706
37705 88277 287356
128259 72622 508647
86944 503...

output:

2446282972628858

result:

ok single line: '2446282972628858'

Test #54:

score: 0
Accepted
time: 146ms
memory: 54020kb

input:

1
200000 6367
70380 149114 697611
23524 123288 201580
113345 98446 914359
155403 174550 931885
115728 41682 603248
91736 145452 134217
105299 122549 590053
191014 94183 993377
148076 141069 545351
29872 85703 228759
36691 129068 941513
117515 135986 756754
56944 103732 12582
137339 72187 25406
19045...

output:

208551940215786

result:

ok single line: '208551940215786'

Test #55:

score: 0
Accepted
time: 143ms
memory: 54840kb

input:

1
200000 137566
143240 193107 137205
175465 145454 402274
1281 20169 504387
5832 112462 438666
162845 44154 582353
44090 60505 429443
66624 75094 212410
141113 62033 906538
109979 180871 454332
171600 92440 117309
53250 151171 229817
64766 49516 985379
101551 186992 95351
152356 43960 728226
162093 ...

output:

3023055135962726

result:

ok single line: '3023055135962726'

Test #56:

score: 0
Accepted
time: 144ms
memory: 55420kb

input:

1
200000 57537
147330 105836 25350
156089 169039 246249
198383 143753 641076
119477 104647 70209
44956 53847 285344
112897 65189 195386
39479 198947 380152
139028 96911 39013
18240 109558 94609
39803 36432 422649
165907 147162 512804
13179 165393 378575
75677 150009 270540
122064 118088 847014
79235...

output:

1641888921110028

result:

ok single line: '1641888921110028'

Test #57:

score: 0
Accepted
time: 129ms
memory: 55108kb

input:

1
200000 188736
145882 57641 178915
181889 43485 831248
175036 103720 519395
45637 82319 300416
185068 28050 705437
59477 153067 312284
171486 77291 428764
182206 22115 5388
182474 85305 410368
194912 134173 546887
142345 73319 733692
134878 172101 86492
104266 150987 175065
60600 19775 231149
85699...

output:

3326162708772488

result:

ok single line: '3326162708772488'

Test #58:

score: 0
Accepted
time: 138ms
memory: 54076kb

input:

1
200000 108707
20962 143665 592181
69566 45524 563334
48835 111252 653080
183251 77287 641834
12113 197817 69797
20344 138884 471569
170303 8089 346762
181582 151852 514610
67616 140329 975977
185644 30006 566203
124363 148233 931354
9333 116044 298572
108919 102917 636390
94649 14407 238778
25179 ...

output:

2626032818350390

result:

ok single line: '2626032818350390'

Test #59:

score: 0
Accepted
time: 154ms
memory: 52404kb

input:

1
200000 28678
79231 180232 225479
32889 111245 785475
89102 119998 443706
180878 151432 793937
134683 127094 165690
122021 82363 18773
182009 134421 578131
15302 58758 438172
692 111651 353074
187207 68097 7318
30855 60295 624938
168096 77051 198231
17544 159920 381424
131401 167128 11863
117365 14...

output:

885040627682312

result:

ok single line: '885040627682312'

Test #60:

score: 0
Accepted
time: 143ms
memory: 54668kb

input:

1
200000 159877
31341 189607 765748
177178 39033 357511
36930 84846 712240
93385 4037 494772
78904 169622 161670
111913 60332 264502
23537 153907 694695
157103 12312 550661
182677 109258 344437
186385 135930 943437
97427 132931 333701
197493 109284 538543
194024 28631 326180
121685 164454 176767
118...

output:

3210768264145290

result:

ok single line: '3210768264145290'

Test #61:

score: 0
Accepted
time: 137ms
memory: 54240kb

input:

1
200000 79848
168709 166852 68617
4026 13698 179959
52854 13065 347642
193200 130540 511400
175396 79112 634526
125334 102489 914916
124462 42919 52751
132123 198420 217319
45182 46139 716552
56204 153980 325645
179936 128824 143338
89396 125043 290393
180709 10664 168568
6862 194776 882353
135269 ...

output:

2125666092604112

result:

ok single line: '2125666092604112'