QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#441157#8580. 철도 2MaMengQi100 ✓260ms95296kbC++232.0kb2024-06-14 13:21:122024-06-14 13:21:14

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 2ms
memory: 8136kb

input:

2
0 1 20240120

output:

20240121
40480240

result:

ok 2 lines

Test #2:

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

input:

5
0 1 3
0 2 2
0 3 2
0 4 1

output:

0
78

result:

ok 2 lines

Test #3:

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

input:

50
0 1 937128492
0 2 226728869
0 3 539355674
0 4 614224269
0 5 980692762
0 6 806890909
0 7 233017937
0 8 213918444
0 9 857044476
0 10 289280409
0 11 876073890
0 12 626686496
0 13 959404425
0 14 219736047
0 15 222487402
0 16 66300728
0 17 969428071
0 18 385773064
0 19 209611324
0 20 324817560
0 21 83...

output:

969493188
310249060

result:

ok 2 lines

Test #4:

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

input:

50
0 1 925520678
0 2 950292087
0 3 548659330
0 4 263822661
0 5 328114050
0 6 73789976
0 7 415149481
0 8 390047285
0 9 828490891
0 10 128887220
0 11 609456854
0 12 533823003
0 13 105430934
0 14 78964041
0 15 193138612
0 16 828792981
0 17 615892415
0 18 767130166
0 19 501535214
0 20 701616356
0 21 395...

output:

652611964
327755971

result:

ok 2 lines

Test #5:

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

input:

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

output:

15
284

result:

ok 2 lines

Test #6:

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

input:

50
0 1 937128492
1 2 226728869
2 3 539355674
3 4 614224269
4 5 980692762
5 6 806890909
6 7 233017937
7 8 213918444
8 9 857044476
9 10 289280409
10 11 876073890
11 12 626686496
12 13 959404425
13 14 219736047
14 15 222487402
15 16 66300728
16 17 969428071
17 18 385773064
18 19 209611324
19 20 3248175...

output:

969491830
834693549

result:

ok 2 lines

Test #7:

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

input:

50
0 1 925520678
1 2 950292087
2 3 548659330
3 4 263822661
4 5 328114050
5 6 73789976
6 7 415149481
7 8 390047285
8 9 828490891
9 10 128887220
10 11 609456854
11 12 533823003
12 13 105430934
13 14 78964041
14 15 193138612
15 16 828792981
16 17 615892415
17 18 767130166
18 19 501535214
19 20 70161635...

output:

652611792
853879195

result:

ok 2 lines

Test #8:

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

input:

5
0 1 1
1 2 2
0 3 3
0 4 2

output:

7
80

result:

ok 2 lines

Test #9:

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

input:

10
6 0 938294862
2 6 302422102
6 1 455648602
0 5 375794064
4 0 501342954
3 8 849534941
1 9 540520252
8 5 461010548
7 3 482274800

output:

538256325
42262127

result:

ok 2 lines

Test #10:

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

input:

20
11 7 247549792
0 9 744200549
17 4 44042924
5 19 773603788
9 10 138033458
0 2 644861447
18 5 732537796
5 0 866287366
8 18 751407587
0 13 598474346
9 12 336482879
5 1 821851441
9 3 725263961
16 5 642308177
19 15 385646184
17 8 120946286
6 0 845683548
8 14 36606264
11 19 509475813

output:

558429805
895650210

result:

ok 2 lines

Test #11:

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

input:

50
1 43 383139131
13 29 950226094
19 20 204235750
37 4 811830087
22 26 89178358
41 4 197242343
23 12 102323641
23 3 880567753
13 46 706897600
13 47 435753300
13 4 216640212
34 24 836612742
21 1 431179997
25 23 455766677
15 16 368863683
25 48 123188597
42 4 747962187
16 31 424481251
6 30 747726405
7 ...

output:

359032388
489041028

result:

ok 2 lines

Test #12:

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

input:

50
17 29 502276510
25 14 190050194
28 12 188919906
40 10 313175312
33 32 456981803
16 21 529638412
44 47 487121657
48 21 611990969
7 0 614925852
33 3 738218990
28 4 205636475
46 11 228589405
0 41 58261729
28 14 699269130
8 13 125541025
5 35 963998402
6 28 458252987
33 26 759930726
28 3 955421782
5 4...

output:

89079886
430158437

result:

ok 2 lines

Test #13:

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

input:

50
38 29 906116423
44 20 906116423
39 43 906116423
6 1 906116423
46 47 906116423
20 15 906116423
5 35 906116423
11 15 906116423
32 36 906116423
22 39 906116423
40 21 906116423
23 17 906116423
46 12 906116423
8 39 906116423
25 41 906116423
39 46 906116423
42 37 906116423
34 21 906116423
9 32 90611642...

output:

906116483
209006759

result:

ok 2 lines

Test #14:

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

input:

50
39 48 1000000000
28 34 1000000000
41 29 1000000000
33 36 1000000000
18 13 1000000000
31 19 1000000000
38 19 1000000000
4 30 1000000000
20 35 1000000000
38 16 1000000000
9 29 1000000000
26 28 1000000000
33 38 1000000000
35 29 1000000000
13 28 1000000000
40 1 1000000000
35 21 1000000000
38 46 10000...

output:

1000000020
999879761

result:

ok 2 lines

Test #15:

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

input:

50
41 14 825684450
0 5 217330353
31 23 343414473
18 42 205829046
44 27 556205253
19 41 215898656
18 38 658283366
18 27 12043624
33 28 277136624
17 18 863116217
23 28 882828997
20 18 423410260
14 33 935424354
0 26 198918795
34 39 198532224
43 18 571654124
0 45 475816843
29 0 896920571
44 10 520179180...

output:

451147135
582029632

result:

ok 2 lines

Test #16:

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

input:

50
37 23 651160988
45 21 198310011
2 13 183246911
17 2 861450346
28 21 902965588
48 45 159516700
34 37 568995549
2 27 650882279
14 2 187300974
41 11 932396091
45 43 792367428
42 16 684437825
37 40 891664992
44 37 507163892
9 4 525945998
45 7 733565626
45 24 366315605
2 26 451389378
45 47 126316604
1...

output:

925626353
125043144

result:

ok 2 lines

Test #17:

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

input:

50
30 35 980918057
12 4 542810679
8 35 141275323
15 35 306070575
2 13 211140989
26 41 466369974
11 47 408892665
39 46 329883049
13 46 111561862
49 35 747036760
37 12 140527803
10 5 711074832
11 19 62063857
29 43 259803366
5 22 876030348
14 43 162174536
1 5 951268738
23 18 428633803
36 42 153187922
2...

output:

182265877
124163460

result:

ok 2 lines

Test #18:

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

input:

50
47 15 830239085
18 37 75211863
3 39 609701971
18 29 57704334
11 8 68677309
10 33 246383718
25 3 302709916
10 49 438857017
32 48 335719446
16 33 797231185
45 35 745926839
11 28 719064326
43 11 236821691
23 35 278664421
5 3 291833227
13 33 141907404
26 35 8319639
33 34 9244404
15 19 710232066
32 34...

output:

416959437
483738497

result:

ok 2 lines

Test #19:

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

input:

50
40 41 484215493
42 30 484215493
1 23 484215493
30 31 484215493
39 23 484215493
16 12 484215493
39 43 484215493
44 32 484215493
41 5 484215493
14 13 484215493
24 20 484215493
7 6 484215493
25 17 484215493
4 7 484215493
23 29 484215493
9 30 484215493
23 24 484215493
13 22 484215493
37 23 484215493
...

output:

484215537
600963746

result:

ok 2 lines

Test #20:

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

input:

50
4 10 216496737
40 28 37293985
37 7 24606691
26 23 1075291
26 25 508966
21 11 529668429
15 7 12023198
11 6 529668429
15 32 36629889
13 38 11071383
11 15 493038540
40 2 18509760
2 34 18784225
11 40 492374444
40 13 26222602
25 19 566325
10 11 313171692
25 14 566325
45 40 37293985
26 1 1075291
2 41 1...

output:

528211339
809335016

result:

ok 2 lines

Test #21:

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

input:

50
44 42 503
26 49 373
2 46 236
37 4 87
23 41 334
7 29 481
30 6 405
30 17 578
16 31 251
13 43 524
1 43 131
48 25 597
42 4 187
29 30 439
30 24 823
21 1 997
13 4 212
13 29 94
30 11 654
36 7 36
24 0 84
41 39 657
16 15 683
18 15 855
5 14 125
46 13 600
40 24 774
4 38 34
22 26 358
23 12 641
25 15 113
19 2...

output:

424944567
118302579

result:

ok 2 lines

Test #22:

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

input:

50
29 17 510
14 25 194
26 17 755
5 45 186
49 32 795
32 36 46
47 44 657
3 28 782
23 18 767
33 26 726
27 22 85
21 16 412
1 33 574
48 21 969
0 41 729
24 28 462
36 31 693
21 11 534
20 11 741
3 5 605
15 28 736
17 38 648
39 1 22
34 21 625
17 44 528
37 7 41
35 5 402
33 3 990
4 28 475
8 13 25
28 12 906
37 1...

output:

575785563
682001508

result:

ok 2 lines

Subtask #2:

score: 6
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 6
Accepted
time: 2ms
memory: 7948kb

input:

500
0 1 937400394
0 2 296015380
0 3 680288507
0 4 369521923
0 5 874221661
0 6 697731267
0 7 960834534
0 8 415452622
0 9 568402532
0 10 72832895
0 11 378287392
0 12 540127187
0 13 216475968
0 14 314911603
0 15 619463021
0 16 237831153
0 17 179291573
0 18 726083154
0 19 756219313
0 20 903014348
0 21 7...

output:

625429141
14762669

result:

ok 2 lines

Test #24:

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

input:

500
0 1 531180947
0 2 466869050
0 3 954605057
0 4 59224892
0 5 454250540
0 6 40915255
0 7 181768689
0 8 402789509
0 9 947695676
0 10 539425342
0 11 316087483
0 12 714696725
0 13 438446291
0 14 392359520
0 15 47934935
0 16 392078712
0 17 52722295
0 18 870380098
0 19 753539958
0 20 523162125
0 21 1334...

output:

670900581
891043317

result:

ok 2 lines

Test #25:

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

input:

500
0 1 937400394
1 2 296015380
2 3 680288507
3 4 369521923
4 5 874221661
5 6 697731267
6 7 960834534
7 8 415452622
8 9 568402532
9 10 72832895
10 11 378287392
11 12 540127187
12 13 216475968
13 14 314911603
14 15 619463021
15 16 237831153
16 17 179291573
17 18 726083154
18 19 756219313
19 20 903014...

output:

626758142
603926263

result:

ok 2 lines

Test #26:

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

input:

500
0 1 531180947
1 2 466869050
2 3 954605057
3 4 59224892
4 5 454250540
5 6 40915255
6 7 181768689
7 8 402789509
8 9 947695676
9 10 539425342
10 11 316087483
11 12 714696725
12 13 438446291
13 14 392359520
14 15 47934935
15 16 392078712
16 17 52722295
17 18 870380098
18 19 753539958
19 20 523162125...

output:

670796010
351023314

result:

ok 2 lines

Test #27:

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

input:

500
353 145 202249809
317 378 555988116
297 313 482888435
138 104 981706397
335 313 201598862
402 171 396182350
322 478 394365362
329 180 483607116
371 336 423993244
136 104 939841557
410 488 701317504
36 171 969517262
312 179 718979892
167 400 199817967
447 0 415726850
311 374 667461081
197 201 471...

output:

593811380
389028263

result:

ok 2 lines

Test #28:

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

input:

500
310 309 985706894
424 366 350230887
126 478 232272063
433 320 568511524
247 291 682361663
432 384 926907128
445 155 274296783
333 133 753245958
234 80 756095380
158 159 203893071
402 228 390817351
83 309 439440178
198 281 920559443
207 493 412668583
199 322 485715876
466 498 315762696
121 219 47...

output:

102739643
134826994

result:

ok 2 lines

Test #29:

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

input:

500
344 347 626430904
428 450 626430904
325 52 626430904
80 109 626430904
30 197 626430904
24 1 626430904
382 434 626430904
384 219 626430904
357 302 626430904
277 276 626430904
289 211 626430904
43 65 626430904
26 175 626430904
197 494 626430904
124 181 626430904
471 106 626430904
251 110 626430904...

output:

626431570
168238394

result:

ok 2 lines

Test #30:

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

input:

500
65 282 1000000000
317 315 1000000000
475 49 1000000000
52 203 1000000000
452 488 1000000000
126 35 1000000000
68 165 1000000000
455 282 1000000000
46 362 1000000000
335 497 1000000000
358 297 1000000000
141 496 1000000000
187 441 1000000000
176 346 1000000000
380 297 1000000000
451 431 100000000...

output:

1000000257
970728835

result:

ok 2 lines

Test #31:

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

input:

500
215 383 202421122
159 65 444914637
423 450 446731989
58 82 841572804
372 142 588212335
243 368 358500491
247 399 59074395
243 136 646290805
487 336 695193488
115 377 946813308
85 243 735330888
243 72 495521225
213 380 181453431
80 241 453401089
358 243 301763984
387 60 197904464
56 422 867396049...

output:

811066150
991274580

result:

ok 2 lines

Test #32:

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

input:

500
398 409 548937677
22 37 882603931
379 2 495129827
127 209 419442350
335 73 607436600
123 199 331925683
365 246 26723794
448 73 839921819
273 409 926707057
311 305 238151974
432 389 643668503
435 468 840659575
256 67 884150345
325 107 830150678
18 199 847951460
36 325 497247484
274 455 712409371
...

output:

277186773
732262254

result:

ok 2 lines

Test #33:

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

input:

500
43 140 516336886
469 291 214875455
442 160 23034048
291 222 94954320
481 293 389093892
52 291 833007494
487 428 877802476
417 214 745407817
392 3 494007673
99 339 322872757
145 163 502224251
27 359 50604799
23 69 602525441
374 117 613547251
59 446 586930514
438 102 186181211
92 253 11312291
166 ...

output:

101720655
125681248

result:

ok 2 lines

Test #34:

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

input:

401
331 293 369232463
138 38 369232463
67 323 369232463
360 104 369232463
206 107 369232463
290 139 369232463
362 200 369232463
285 222 369232463
370 325 369232463
344 135 369232463
32 393 369232463
337 87 369232463
158 52 369232463
261 67 369232463
241 134 369232463
391 372 369232463
237 384 369232...

output:

1662
396809027

result:

ok 2 lines

Test #35:

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

input:

500
101 392 1732505
457 189 5002136
401 416 1467309
477 300 101342451
49 105 21876533
274 125 13500651
474 331 1146838
268 48 411150031
43 38 15324295
233 131 3667079
143 413 359965
210 296 167952760
147 291 14405429
107 399 11793462
261 301 423404676
233 376 1899859
311 259 718125
428 232 1497913
3...

output:

636901572
9733513

result:

ok 2 lines

Test #36:

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

input:

500
386 208 864
302 432 419
73 383 34
56 161 261
419 481 795
329 180 116
72 377 932
270 192 848
410 488 504
421 260 354
175 488 879
428 84 736
324 144 173
340 255 735
210 262 53
147 155 475
353 378 427
42 305 753
80 71 799
346 165 706
391 363 667
301 184 648
95 66 613
351 245 587
122 224 916
457 451...

output:

531404319
967489387

result:

ok 2 lines

Test #37:

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

input:

500
7 435 896
349 360 34
490 116 46
402 358 582
339 106 117
446 395 903
208 141 768
478 126 63
169 123 405
347 453 107
317 167 857
83 193 511
486 444 772
133 35 191
441 175 596
247 291 663
397 288 363
459 306 716
287 200 601
348 61 379
323 153 358
470 411 89
115 493 38
418 299 715
105 245 729
150 43...

output:

766642696
323500442

result:

ok 2 lines

Subtask #3:

score: 19
Accepted

Dependency #2:

100%
Accepted

Test #38:

score: 19
Accepted
time: 2ms
memory: 8072kb

input:

2000
0 1 26116317
0 2 624538297
0 3 201886595
0 4 396755017
0 5 793358702
0 6 773636356
0 7 643905499
0 8 500597547
0 9 237666560
0 10 851118024
0 11 580365753
0 12 35672303
0 13 800297319
0 14 871601223
0 15 660133397
0 16 869316040
0 17 94057691
0 18 974261957
0 19 976396423
0 20 406404909
0 21 54...

output:

616989034
564929157

result:

ok 2 lines

Test #39:

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

input:

2000
0 1 454712240
0 2 338874658
0 3 851484987
0 4 449209010
0 5 765290473
0 6 955767899
0 7 525067044
0 8 322300858
0 9 222497563
0 10 879468284
0 11 927693748
0 12 771633404
0 13 364558017
0 14 547285136
0 15 567849841
0 16 220813088
0 17 325671688
0 18 266185847
0 19 58227922
0 20 265237469
0 21 ...

output:

232238631
35572417

result:

ok 2 lines

Test #40:

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

input:

2000
0 1 26116317
1 2 624538297
2 3 201886595
3 4 396755017
4 5 793358702
5 6 773636356
6 7 643905499
7 8 500597547
8 9 237666560
9 10 851118024
10 11 580365753
11 12 35672303
12 13 800297319
13 14 871601223
14 15 660133397
15 16 869316040
16 17 94057691
17 18 974261957
18 19 976396423
19 20 4064049...

output:

618077973
966297757

result:

ok 2 lines

Test #41:

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

input:

2000
0 1 454712240
1 2 338874658
2 3 851484987
3 4 449209010
4 5 765290473
5 6 955767899
6 7 525067044
7 8 322300858
8 9 222497563
9 10 879468284
10 11 927693748
11 12 771633404
12 13 364558017
13 14 547285136
14 15 567849841
15 16 220813088
16 17 325671688
17 18 266185847
18 19 58227922
19 20 26523...

output:

232589544
684457856

result:

ok 2 lines

Test #42:

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

input:

2000
855 1250 129883504
154 361 887682183
1589 1137 456210838
580 205 933448969
166 783 271541039
235 1274 8264295
1336 971 525707237
832 818 263951315
1162 999 609757271
525 448 723484863
1973 1696 392594689
510 891 541364537
1357 1308 522585788
475 836 263422862
530 1915 845597647
676 1943 3506105...

output:

687524212
776986504

result:

ok 2 lines

Test #43:

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

input:

2000
1370 1342 96099440
460 621 972823161
822 776 119269744
1357 147 266941085
615 1008 528750869
1796 440 820075011
1281 1183 35704851
1615 1391 420904411
700 358 715540824
529 1591 124688591
500 628 693359703
375 1669 784523791
1130 1727 711160055
1112 465 262188770
55 1006 454697387
119 594 77924...

output:

366560681
307369946

result:

ok 2 lines

Test #44:

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

input:

2000
1165 1054 819995056
509 978 819995056
1421 1776 819995056
1177 1485 819995056
483 1581 819995056
1796 1142 819995056
138 359 819995056
517 1909 819995056
122 1218 819995056
896 794 819995056
1817 1474 819995056
51 1653 819995056
1519 1852 819995056
698 392 819995056
1419 422 819995056
185 43 81...

output:

820001738
732015112

result:

ok 2 lines

Test #45:

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

input:

2000
1363 623 1000000000
717 1769 1000000000
1263 183 1000000000
1737 1196 1000000000
1934 1959 1000000000
1249 1206 1000000000
739 1391 1000000000
140 1949 1000000000
63 1625 1000000000
716 740 1000000000
1218 1998 1000000000
1989 554 1000000000
568 692 1000000000
285 343 1000000000
1300 392 100000...

output:

999999232
493213545

result:

ok 2 lines

Test #46:

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

input:

2000
667 265 530258002
819 525 766413205
310 906 517099883
1161 1749 199416298
416 196 905961250
723 243 322073499
3 1996 353906305
1391 1164 223454476
942 1401 273811007
1467 1052 233476742
422 1674 88879438
1161 1719 645868554
762 1391 454600151
804 1391 10128245
291 82 457615068
1198 1024 8603337...

output:

642894781
884635992

result:

ok 2 lines

Test #47:

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

input:

2000
895 101 630535000
201 1973 696037838
1280 1042 289258422
1890 1841 679254872
264 69 98938481
1239 1600 576372563
945 1839 47705671
201 662 430839085
318 1184 873116298
1208 1805 110387486
1753 1376 68392844
1672 1753 884654426
1740 1753 777899139
1415 1753 373570246
1346 945 898668228
1799 412 ...

output:

377325539
368325835

result:

ok 2 lines

Test #48:

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

input:

2000
1843 772 83567378
960 221 607953002
190 672 627431376
470 1656 157325681
1631 1005 331374288
1445 358 175998392
56 1129 578276100
497 1738 280422814
1024 1371 676546041
785 76 693192015
370 988 818419190
50 1751 102299073
1850 1274 920328095
1765 418 921979855
1883 1244 971557435
778 1579 86838...

output:

729465573
393766840

result:

ok 2 lines

Test #49:

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

input:

2000
756 1874 33991553
261 1798 7437858
1194 1296 986413051
1989 261 753362300
1194 278 986413051
1082 742 60497775
529 1082 60497775
988 1790 112517340
1798 44 760800158
1679 756 33991553
1082 97 60497775
1790 902 112517340
1451 1830 583160109
1975 200 104440947
1830 134 583160109
883 1975 10444094...

output:

299840223
793106309

result:

ok 2 lines

Test #50:

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

input:

2000
1213 1018 470310
299 796 29613108
466 1605 66351981
497 518 797007
1886 119 31062
299 1611 29613108
574 1600 184408790
528 1040 19419963
564 1241 17689579
1369 1458 3080047
1020 1147 224230182
1629 410 140363
395 1837 65046795
440 1781 103218093
1833 674 4747355
1474 948 157672
1768 1250 536580...

output:

977013821
348279870

result:

ok 2 lines

Test #51:

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

input:

2000
1823 930 711
1708 357 784
599 1025 292
1559 48 457
385 1585 701
1503 1502 414
113 259 942
1817 776 903
1247 364 619
1830 253 793
1435 1944 899
874 26 174
1629 1057 774
322 333 273
653 112 892
997 1318 556
1042 1622 649
643 1160 393
1034 1780 415
1102 384 305
1132 1080 319
338 506 442
718 1061 5...

output:

159462587
912227763

result:

ok 2 lines

Subtask #4:

score: 5
Accepted

Test #52:

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

input:

8000
0 1 434537623
0 2 478828955
0 3 787533732
0 4 249043358
0 5 462438986
0 6 537772988
0 7 234351648
0 8 194422641
0 9 843037710
0 10 865186886
0 11 912198999
0 12 928827511
0 13 567791833
0 14 186545621
0 15 205357715
0 16 345572077
0 17 364768104
0 18 434497130
0 19 854260002
0 20 836843191
0 21...

output:

439416954
35040453

result:

ok 2 lines

Test #53:

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

input:

8000
0 1 158100841
0 2 47941124
0 3 732099421
0 4 596464647
0 5 579594949
0 6 719904531
0 7 410480489
0 8 16125951
0 9 827868713
0 10 598569850
0 11 114302802
0 12 74854020
0 13 281795635
0 14 157196831
0 15 672882672
0 16 992036421
0 17 451157909
0 18 431453724
0 19 936091501
0 20 400708456
0 21 42...

output:

910812213
896103219

result:

ok 2 lines

Test #54:

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

input:

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

output:

382254115
266405333

result:

ok 2 lines

Test #55:

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

input:

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

output:

391549772
655654657

result:

ok 2 lines

Test #56:

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

input:

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

output:

1000000000
104223993

result:

ok 2 lines

Subtask #5:

score: 7
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #57:

score: 7
Accepted
time: 4ms
memory: 9428kb

input:

8000
0 1 434537623
1 2 478828955
2 3 787533732
3 4 249043358
4 5 462438986
5 6 537772988
6 7 234351648
7 8 194422641
8 9 843037710
9 10 865186886
10 11 912198999
11 12 928827511
12 13 567791833
13 14 186545621
14 15 205357715
15 16 345572077
16 17 364768104
17 18 434497130
18 19 854260002
19 20 8368...

output:

456123363
583741509

result:

ok 2 lines

Test #58:

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

input:

8000
0 1 158100841
1 2 47941124
2 3 732099421
3 4 596464647
4 5 579594949
5 6 719904531
6 7 410480489
7 8 16125951
8 9 827868713
9 10 598569850
10 11 114302802
11 12 74854020
12 13 281795635
13 14 157196831
14 15 672882672
15 16 992036421
16 17 451157909
17 18 431453724
18 19 936091501
19 20 4007084...

output:

928359490
634619036

result:

ok 2 lines

Test #59:

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

input:

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

output:

382262114
674762276

result:

ok 2 lines

Test #60:

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

input:

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

output:

391565771
914814255

result:

ok 2 lines

Test #61:

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

input:

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

output:

1000015999
226636723

result:

ok 2 lines

Subtask #6:

score: 15
Accepted

Test #62:

score: 15
Accepted
time: 4ms
memory: 8828kb

input:

8000
4617 7335 225825999
4464 5774 488410651
2660 3658 223719975
432 5265 836988940
1630 7708 615964857
7565 4040 64637864
2670 6404 648947820
4307 4693 300142488
868 3614 605118300
845 7028 588280191
2224 6228 205473201
7889 7604 140705960
1994 6087 201006023
3153 7826 770004391
4867 503 484083800
...

output:

163656721
764150784

result:

ok 2 lines

Test #63:

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

input:

8000
662 437 869131969
7260 6220 872252692
858 3257 13161292
3947 1621 665033974
6125 1937 443778849
7823 5558 158682449
7191 3735 572025754
3465 7237 988374250
6973 7566 690569481
2631 7152 244120246
509 2836 602277458
7388 1184 409633533
4332 5065 325173347
1673 2998 871805810
5993 3132 249156915
...

output:

715946278
794602472

result:

ok 2 lines

Test #64:

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

input:

8000
1011 4544 566920861
3724 4456 566920861
2480 5773 566920861
7155 180 566920861
7752 7728 566920861
3522 7854 566920861
5906 810 566920861
4061 7716 566920861
4408 6136 566920861
3424 3160 566920861
5118 2231 566920861
4367 1128 566920861
1692 1443 566920861
3276 6059 566920861
7780 4443 5669208...

output:

566941121
34830225

result:

ok 2 lines

Test #65:

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

input:

8000
5474 7528 1000000000
4035 2799 1000000000
7835 3517 1000000000
3782 1326 1000000000
4962 2217 1000000000
4653 155 1000000000
2901 7033 1000000000
4073 4267 1000000000
2065 5715 1000000000
5458 5620 1000000000
2984 7463 1000000000
3086 6203 1000000000
3189 6380 1000000000
1594 2301 1000000000
16...

output:

1000014544
388673211

result:

ok 2 lines

Test #66:

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

input:

8000
6331 983 620500266
5534 6331 328052612
340 3752 265770308
5793 4479 272242533
6033 6331 812279851
3371 7465 776252182
2818 621 221402011
4794 3342 674896796
5355 6331 452960424
4993 916 593163624
5131 5793 10241083
2864 4960 198222953
5793 6874 549989322
6556 7901 875522836
7208 6331 184195722
...

output:

380363926
15273238

result:

ok 2 lines

Test #67:

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

input:

8000
6061 4442 490666714
3676 692 403961415
4534 5291 77113756
496 6823 632042331
6125 3545 338484421
3232 454 28047315
7215 374 11962112
1305 5759 83514104
5765 4175 159871244
5625 2304 287468640
2424 1544 330132679
3184 7103 800868307
3327 1897 821323849
5800 7693 928755508
1830 7015 869593117
130...

output:

1065579994
851677733

result:

ok 2 lines

Test #68:

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

input:

8000
2709 5547 178071936
998 5339 591395539
4420 3475 464019588
6033 6874 287717398
6148 6337 870368379
4142 2552 883684109
96 2531 765084675
1292 632 3508901
2080 2541 256751884
2850 5520 710461242
6069 7450 482123407
1922 3063 506581703
2397 5448 733699715
7439 3362 639892002
1345 3390 624234275
3...

output:

693064406
652938750

result:

ok 2 lines

Test #69:

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

input:

8000
6444 2301 134808032
6444 3635 134808032
7302 2400 329837750
731 7952 63198131
5520 5271 271758807
2730 2949 306226502
4481 3455 554049
4458 954 67328975
7695 182 193375626
4183 984 89651435
7426 7308 359484546
3291 3615 718343596
1265 7303 135149713
6332 5271 271758807
1265 2151 135149713
858 5...

output:

666879023
906889894

result:

ok 2 lines

Test #70:

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

input:

8000
628 418 309924994
7137 7066 91375840
5634 2988 29792836
2456 3175 5372810
888 1336 299664136
1921 502 21037242
3663 7066 91375840
7508 1043 8325314
2952 2902 101074842
7066 1063 91375840
4982 6282 120025758
7159 294 358969
5293 1841 20619734
5554 5807 133397935
3373 512 219654367
1921 4908 2103...

output:

162352961
488408662

result:

ok 2 lines

Test #71:

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

input:

8000
2089 1318 814
4385 2902 905
740 6145 360
3384 2955 68
7628 711 682
2604 3140 865
5386 5719 272
3905 7106 582
6533 5120 170
1874 3616 734
3396 4025 804
4073 5781 468
6532 4981 48
1797 3316 327
3455 6355 748
3801 5165 108
6516 1346 367
5752 691 117
153 36 275
1011 6873 744
7886 544 501
1326 542 7...

output:

458545554
998157532

result:

ok 2 lines

Subtask #7:

score: 4
Accepted

Test #72:

score: 4
Accepted
time: 128ms
memory: 62420kb

input:

500000
0 1 127893823
0 2 712070820
0 3 850868730
0 4 472364726
0 5 124196255
0 6 286943756
0 7 705140831
0 8 750913497
0 9 401932021
0 10 803232493
0 11 616908827
0 12 501857355
0 13 640865599
0 14 91847928
0 15 326405238
0 16 367428885
0 17 325664177
0 18 910096432
0 19 359618350
0 20 236732118
0 2...

output:

244110288
241035116

result:

ok 2 lines

Test #73:

score: 0
Accepted
time: 125ms
memory: 61912kb

input:

500000
0 1 697005992
0 2 361669213
0 3 48546915
0 4 589520689
0 5 306327799
0 6 168105301
0 7 821811438
0 8 590520308
0 9 135314985
0 10 855593192
0 11 57902632
0 12 920893860
0 13 316549513
0 14 854340180
0 15 972869582
0 16 453818690
0 17 617588067
0 18 991927931
0 19 923483614
0 20 164958130
0 21...

output:

236510047
750129075

result:

ok 2 lines

Test #74:

score: 0
Accepted
time: 94ms
memory: 61200kb

input:

500000
0 1 55679468
0 2 55679468
0 3 55679468
0 4 55679468
0 5 55679468
0 6 55679468
0 7 55679468
0 8 55679468
0 9 55679468
0 10 55679468
0 11 55679468
0 12 55679468
0 13 55679468
0 14 55679468
0 15 55679468
0 16 55679468
0 17 55679468
0 18 55679468
0 19 55679468
0 20 55679468
0 21 55679468
0 22 556...

output:

55679468
298001814

result:

ok 2 lines

Test #75:

score: 0
Accepted
time: 88ms
memory: 60756kb

input:

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

output:

745157
828444258

result:

ok 2 lines

Test #76:

score: 0
Accepted
time: 88ms
memory: 61632kb

input:

500000
0 1 1000000000
0 2 1000000000
0 3 1000000000
0 4 1000000000
0 5 1000000000
0 6 1000000000
0 7 1000000000
0 8 1000000000
0 9 1000000000
0 10 1000000000
0 11 1000000000
0 12 1000000000
0 13 1000000000
0 14 1000000000
0 15 1000000000
0 16 1000000000
0 17 1000000000
0 18 1000000000
0 19 100000000...

output:

1000000000
14024486

result:

ok 2 lines

Subtask #8:

score: 11
Accepted

Test #77:

score: 11
Accepted
time: 147ms
memory: 93892kb

input:

500000
0 1 127893823
1 2 712070820
2 3 850868730
3 4 472364726
4 5 124196255
5 6 286943756
6 7 705140831
7 8 750913497
8 9 401932021
9 10 803232493
10 11 616908827
11 12 501857355
12 13 640865599
13 14 91847928
14 15 326405238
15 16 367428885
16 17 325664177
17 18 910096432
18 19 359618350
19 20 236...

output:

74613833
126811219

result:

ok 2 lines

Test #78:

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

input:

500000
0 1 697005992
1 2 361669213
2 3 48546915
3 4 589520689
4 5 306327799
5 6 168105301
6 7 821811438
7 8 590520308
8 9 135314985
9 10 855593192
10 11 57902632
11 12 920893860
12 13 316549513
13 14 854340180
14 15 972869582
15 16 453818690
16 17 617588067
17 18 991927931
18 19 923483614
19 20 1649...

output:

665834566
719727664

result:

ok 2 lines

Test #79:

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

input:

500000
0 1 55679468
1 2 55679468
2 3 55679468
3 4 55679468
4 5 55679468
5 6 55679468
6 7 55679468
7 8 55679468
8 9 55679468
9 10 55679468
10 11 55679468
11 12 55679468
12 13 55679468
13 14 55679468
14 15 55679468
15 16 55679468
16 17 55679468
17 18 55679468
18 19 55679468
19 20 55679468
20 21 556794...

output:

56679467
804364164

result:

ok 2 lines

Test #80:

score: 0
Accepted
time: 142ms
memory: 93624kb

input:

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

output:

245156
936031283

result:

ok 2 lines

Test #81:

score: 0
Accepted
time: 147ms
memory: 95296kb

input:

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

output:

1000999999
247067994

result:

ok 2 lines

Subtask #9:

score: 30
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Test #82:

score: 30
Accepted
time: 217ms
memory: 58208kb

input:

500000
308120 290898 378179306
163844 396696 392282353
325625 286733 324674542
200084 338268 869731894
216642 139079 873911370
93648 169733 763379413
416566 239037 10846730
2043 270846 536840139
14674 415112 451693861
282108 216289 242323056
345440 149682 633387595
322244 465787 272566995
167886 391...

output:

907321525
244755283

result:

ok 2 lines

Test #83:

score: 0
Accepted
time: 231ms
memory: 58520kb

input:

500000
309357 375525 155428404
26013 243884 824536811
472476 263358 841520746
482502 385836 821492436
226093 326216 517988662
161040 18049 650734525
390092 219472 22119088
355713 456611 657355089
289095 256055 912305220
146751 57201 659611652
358809 403126 34547263
189453 398824 681016408
302248 488...

output:

794293464
442295063

result:

ok 2 lines

Test #84:

score: 0
Accepted
time: 210ms
memory: 58396kb

input:

500000
239946 299635 942575391
361060 428285 942575391
388627 142270 942575391
14885 78428 942575391
286232 76218 942575391
261097 314993 942575391
77536 490290 942575391
39586 292927 942575391
472679 92960 942575391
428878 235516 942575391
469671 238220 942575391
48234 152059 942575391
384452 12667...

output:

942764939
425123461

result:

ok 2 lines

Test #85:

score: 0
Accepted
time: 210ms
memory: 57896kb

input:

500000
137041 304979 1000000000
143796 104109 1000000000
286945 26395 1000000000
307893 214187 1000000000
178964 293441 1000000000
422736 345672 1000000000
53667 119470 1000000000
218840 470144 1000000000
456178 452514 1000000000
247052 370005 1000000000
101570 64078 1000000000
484592 13874 10000000...

output:

1000935015
619162291

result:

ok 2 lines

Test #86:

score: 0
Accepted
time: 260ms
memory: 69848kb

input:

500000
431569 120834 789160771
172423 336028 842052825
115561 238884 44176744
120834 499680 80402419
180387 251921 79481002
320158 372669 339559470
139976 364971 796927017
100196 386937 734507523
321794 180387 646154218
162205 199550 332356285
58425 172423 216357179
322682 172423 162057591
340966 44...

output:

159943885
990092802

result:

ok 2 lines

Test #87:

score: 0
Accepted
time: 236ms
memory: 57848kb

input:

500000
86292 485281 550855491
433235 292625 569792658
185939 114086 712245540
316463 124205 763140930
265579 238408 268734783
152019 209416 290398143
523 171729 946150689
455092 313167 886367088
153790 2250 649921532
497687 46218 443071159
261702 76573 397326751
235659 302394 700298142
284342 411868...

output:

479116484
273377717

result:

ok 2 lines

Test #88:

score: 0
Accepted
time: 237ms
memory: 57868kb

input:

500000
319024 220055 861005743
118107 424697 887302062
420684 266449 700713669
85128 102615 431439479
17858 140944 626958603
201324 248603 20678382
212284 95001 661620829
83057 445970 838675862
134677 96415 640223143
252890 443736 42915064
185830 325681 381527399
399298 414804 861082909
139122 39485...

output:

844823466
598144648

result:

ok 2 lines

Test #89:

score: 0
Accepted
time: 171ms
memory: 48992kb

input:

400001
395215 336879 302470798
338281 158846 302470798
213810 382594 302470798
242006 223819 302470798
90136 27512 302470798
32917 64676 302470798
338430 120279 302470798
319863 97820 302470798
56236 38971 302470798
48758 371998 302470798
197805 122344 302470798
79888 113237 302470798
231375 289309 ...

output:

721397
570176434

result:

ok 2 lines

Test #90:

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

input:

500000
357738 181952 266941
184670 181952 266941
307536 453789 651960782
181952 447581 266941
362787 136095 99285056
181952 441634 266941
227154 400471 373631
462140 74870 16515519
370983 362787 99285056
310746 462140 16515519
8915 458594 7086452
462140 87112 16515519
227154 4823 373631
181952 35229...

output:

191131434
936182444

result:

ok 2 lines

Test #91:

score: 0
Accepted
time: 151ms
memory: 59640kb

input:

500000
422604 13181 9600335
350015 119103 121312896
63205 284636 2355364
463648 61237 180742416
371864 221812 11798409
484747 193752 11382855
380005 124185 65781815
85488 301580 236933212
321513 168714 111006242
324500 407960 15150556
471986 370364 276747128
236155 271092 854852193
194799 322594 197...

output:

318587353
252868019

result:

ok 2 lines

Test #92:

score: 0
Accepted
time: 167ms
memory: 60368kb

input:

500000
430823 235939 58565
269506 216832 1081605
448901 71078 390954
275289 4459 54954833
21289 92202 124447882
120651 72882 2945
454922 66649 916476
1796 383729 5340108
302548 45222 406478
157306 321866 421685
304950 173535 312619
337828 126434 6557575
3436 13299 19142266
317612 211281 145002
28182...

output:

757212574
735162789

result:

ok 2 lines

Test #93:

score: 0
Accepted
time: 207ms
memory: 58656kb

input:

500000
150908 152478 907
99971 258854 435
244623 31805 443
359120 21793 623
490661 133903 629
74960 365094 60
425884 205047 395
206434 12391 536
38358 45290 558
333789 333981 945
172083 49786 286
4727 127165 458
381313 221502 913
179784 61921 15
448461 326063 136
485289 403929 930
14172 374086 889
6...

output:

394072333
803495528

result:

ok 2 lines