QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#430458#8256. Construction Project 2TouJuan#45 7ms12804kbC++141.3kb2024-06-03 20:37:312024-06-03 20:37:33

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

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

input:

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

output:

42

result:

ok single line: '42'

Test #2:

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

input:

50 44
26 33 1 2
1 33 1
2 26 1
5 26 1
6 33 1
7 26 1
8 26 1
9 26 1
10 26 1
11 26 1
12 26 1
13 33 1
14 33 1
17 33 1
19 33 1
20 33 1
22 26 1
23 26 1
24 33 1
25 33 1
26 27 1
29 33 1
31 33 1
33 34 1
33 35 1
33 36 1
33 37 1
33 38 1
26 39 1
33 40 1
33 41 1
33 42 1
26 44 1
26 46 1
26 47 1
33 48 1
26 49 1
33 ...

output:

38

result:

ok single line: '38'

Test #3:

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

input:

3000 2419
1360 1389 1 2
1 1360 1
2 1360 1
3 1360 1
4 1389 1
5 1389 1
6 1389 1
7 1389 1
8 1360 1
9 1360 1
10 1360 1
11 1389 1
12 1360 1
13 1360 1
14 1389 1
15 1389 1
16 1389 1
18 1360 1
19 1360 1
20 1360 1
21 1360 1
22 1389 1
23 1360 1
24 1360 1
25 1389 1
26 1389 1
27 1360 1
28 1389 1
29 1360 1
30 13...

output:

2414

result:

ok single line: '2414'

Test #4:

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

input:

3000 2426
30 2955 1 2
1 2955 1
2 2955 1
3 2955 1
4 30 1
5 30 1
6 30 1
7 2955 1
8 30 1
10 2955 1
11 2955 1
12 30 1
13 30 1
15 2955 1
16 2955 1
17 30 1
18 30 1
19 2955 1
20 2955 1
21 2955 1
22 30 1
23 30 1
25 2955 1
26 2955 1
27 2955 1
28 2955 1
29 30 1
31 2955 1
30 32 1
34 2955 1
30 35 1
36 2955 1
30...

output:

4498500

result:

ok single line: '4498500'

Test #5:

score: -8
Time Limit Exceeded

input:

200000 160037
88185 132270 1 2
1 132270 1
3 132270 1
5 132270 1
6 88185 1
8 88185 1
9 88185 1
10 132270 1
11 132270 1
13 132270 1
16 132270 1
17 88185 1
18 88185 1
20 88185 1
21 132270 1
22 132270 1
23 132270 1
24 132270 1
25 88185 1
26 132270 1
27 132270 1
28 88185 1
29 132270 1
31 88185 1
32 88185...

output:


result:


Subtask #2:

score: 16
Accepted

Test #28:

score: 16
Accepted
time: 2ms
memory: 11260kb

input:

10 45
3 9 48001343 237852277
1 4 716247826
1 9 297456468
4 6 735727475
2 8 320343417
7 9 689896692
2 5 701067214
2 7 77422890
1 7 165861933
8 9 647608572
2 9 619230449
5 10 322773035
3 5 438584763
2 6 184583372
1 6 671713339
5 9 926450489
3 4 155266400
3 8 524274898
6 9 621438120
1 2 388629374
6 8 3...

output:

3

result:

ok single line: '3'

Test #29:

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

input:

50 25
28 31 517111554 4785421536
1 29 50881664
23 28 227292135
27 30 671954238
15 38 318924437
2 12 593515726
34 48 809321109
25 32 420432800
13 38 851093542
46 47 415426245
12 16 449037819
21 26 46799507
17 47 550171135
7 25 742117593
2 16 663763300
12 38 627639003
18 22 178724904
17 39 581167096
1...

output:

4

result:

ok single line: '4'

Test #30:

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

input:

50 50
35 37 202335917 1783119420
4 25 921403824
5 37 863628607
2 3 481462008
3 7 136648030
26 32 394170449
14 42 687142065
8 48 439408737
9 31 986589592
12 32 300012389
22 41 609774899
27 44 553941369
5 13 451110464
5 11 834488498
20 25 938624074
20 36 963261736
15 36 283215476
24 44 652058981
15 25...

output:

1225

result:

ok single line: '1225'

Test #31:

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

input:

50 50
3 16 226988118 931961588
3 29 60317431
24 45 40418630
31 33 206629327
11 14 569111082
17 19 529884319
34 36 128886324
13 23 286351330
5 12 813574559
10 40 186268235
29 37 754174858
36 47 771247261
20 24 275653822
31 49 860154492
23 37 338828277
13 39 228821838
17 29 71993788
6 33 120972460
48 ...

output:

20

result:

ok single line: '20'

Test #32:

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

input:

45 50
23 40 1 7265158065
3 23 117103728
15 35 205131281
30 41 5608977
17 31 646469662
13 31 439955161
10 25 546992253
21 27 924429614
22 29 459058431
22 44 342375130
35 42 744337772
16 39 823117757
11 39 453450429
19 40 800250952
35 37 989299285
8 41 387227075
24 40 419234993
18 32 307592927
10 37 4...

output:

802

result:

ok single line: '802'

Test #33:

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

input:

50 50
26 46 1 16474572356
2 9 678194444
42 48 631558289
1 25 212407978
24 49 55775748
8 13 514389450
19 20 486297511
6 27 142770345
7 22 561723213
42 44 58227125
12 18 568467392
34 38 862812064
4 17 660692501
7 23 339974629
34 43 385963771
46 47 459760428
10 31 339284104
19 40 666793010
13 32 843860...

output:

1069

result:

ok single line: '1069'

Test #34:

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

input:

50 49
1 37 62077031 8696776315
1 2 292522155
2 3 869840090
3 4 178094257
4 5 525073932
5 6 210458171
6 7 724541833
7 8 45171648
8 9 236436225
9 10 889545720
10 11 530973359
11 12 782755079
12 13 241386498
13 14 423300413
14 15 904101124
15 16 529285946
16 17 437362596
17 18 109246525
18 19 668702439...

output:

304

result:

ok single line: '304'

Test #35:

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

input:

50 49
2 44 568136495 10624401863
1 2 157405469
2 3 898172713
3 4 641565182
4 5 592223593
5 6 493808282
6 7 20317004
7 8 419298042
8 9 927082192
9 10 134095077
10 11 189996718
11 12 1255599
12 13 706502656
13 14 755414640
14 15 441555083
15 16 64428484
16 17 533395510
17 18 189797682
18 19 881414997
...

output:

417

result:

ok single line: '417'

Test #36:

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

input:

10 45
3 9 48001343 187948044
1 4 716247826
1 9 297456468
4 6 735727475
2 8 320343417
7 9 689896692
2 5 701067214
2 7 77422890
1 7 165861933
8 9 647608572
2 9 619230449
5 10 322773035
3 5 438584763
2 6 184583372
1 6 671713339
5 9 926450489
3 4 155266400
3 8 524274898
6 9 621438120
1 2 388629374
6 8 3...

output:

2

result:

ok single line: '2'

Test #37:

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

input:

50 25
28 31 517111554 792814785421536
1 29 50881664
23 28 227292135
27 30 671954238
15 38 318924437
2 12 593515726
34 48 809321109
25 32 420432800
13 38 851093542
46 47 415426245
12 16 449037819
21 26 46799507
17 47 550171135
7 25 742117593
2 16 663763300
12 38 627639003
18 22 178724904
17 39 581167...

output:

4

result:

ok single line: '4'

Test #38:

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

input:

50 50
35 37 202335917 1093895627
4 25 921403824
5 37 863628607
2 3 481462008
3 7 136648030
26 32 394170449
14 42 687142065
8 48 439408737
9 31 986589592
12 32 300012389
22 41 609774899
27 44 553941369
5 13 451110464
5 11 834488498
20 25 938624074
20 36 963261736
15 36 283215476
24 44 652058981
15 25...

output:

6

result:

ok single line: '6'

Test #39:

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

input:

50 50
3 16 226988118 831720149938959
3 29 60317431
24 45 40418630
31 33 206629327
11 14 569111082
17 19 529884319
34 36 128886324
13 23 286351330
5 12 813574559
10 40 186268235
29 37 754174858
36 47 771247261
20 24 275653822
31 49 860154492
23 37 338828277
13 39 228821838
17 29 71993788
6 33 1209724...

output:

41

result:

ok single line: '41'

Test #40:

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

input:

50 49
22 31 326576217 893777453
1 5 869840090
2 5 178094257
3 5 525073932
4 5 210458171
5 6 724541833
5 7 45171648
5 8 236436225
5 9 889545720
5 10 530973359
5 11 782755079
5 12 241386498
5 13 423300413
5 14 904101124
5 15 529285946
5 16 437362596
5 17 109246525
5 18 668702439
5 19 410617561
5 20 97...

output:

9

result:

ok single line: '9'

Test #41:

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

input:

50 49
2 45 87438492 617116363
1 19 898172713
2 19 641565182
3 19 592223593
4 19 493808282
5 19 20317004
6 19 419298042
7 19 927082192
8 19 134095077
9 19 189996718
10 19 1255599
11 19 706502656
12 19 755414640
13 19 441555083
14 19 64428484
15 19 533395510
16 19 189797682
17 19 881414997
18 19 85131...

output:

10

result:

ok single line: '10'

Test #42:

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

input:

27 48
1 27 291537623 291537625
2 3 2
3 26 999999994
2 4 3
4 26 999999992
2 5 4
5 26 999999990
2 6 5
6 26 999999988
2 7 6
7 26 999999986
2 8 7
8 26 999999984
2 9 8
9 26 999999982
2 10 9
10 26 999999980
2 11 10
11 26 999999978
2 12 11
12 26 999999976
2 13 12
13 26 999999974
2 14 13
14 26 999999972
2 1...

output:

4

result:

ok single line: '4'

Test #43:

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

input:

27 48
1 27 290846782 290846785
2 3 2
3 26 999999994
2 4 3
4 26 999999992
2 5 4
5 26 999999990
2 6 5
6 26 999999988
2 7 6
7 26 999999986
2 8 7
8 26 999999984
2 9 8
9 26 999999982
2 10 9
10 26 999999980
2 11 10
11 26 999999978
2 12 11
12 26 999999976
2 13 12
13 26 999999974
2 14 13
14 26 999999972
2 1...

output:

5

result:

ok single line: '5'

Test #44:

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

input:

33 48
1 13 8 21
1 2 3
2 3 4
3 4 6
4 5 10
5 6 18
6 7 34
7 8 66
8 9 130
9 10 258
10 11 514
11 12 1026
12 13 2050
13 14 4098
14 15 8194
15 16 16386
16 17 32770
1 18 1
2 18 1
2 19 1
3 19 1
3 20 1
4 20 1
4 21 1
5 21 1
5 22 1
6 22 1
6 23 1
7 23 1
7 24 1
8 24 1
8 25 1
9 25 1
9 26 1
10 26 1
10 27 1
11 27 1
...

output:

181

result:

ok single line: '181'

Test #45:

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

input:

33 48
20 23 2 5
1 2 3
2 3 4
3 4 6
4 5 10
5 6 18
6 7 34
7 8 66
8 9 130
9 10 258
10 11 514
11 12 1026
12 13 2050
13 14 4098
14 15 8194
15 16 16386
16 17 32770
1 18 1
2 18 1
2 19 1
3 19 1
3 20 1
4 20 1
4 21 1
5 21 1
5 22 1
6 22 1
6 23 1
7 23 1
7 24 1
8 24 1
8 25 1
9 25 1
9 26 1
10 26 1
10 27 1
11 27 1
...

output:

25

result:

ok single line: '25'

Test #46:

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

input:

4 3
1 4 8 19
1 2 5
2 3 6
3 4 7

output:

6

result:

ok single line: '6'

Test #47:

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

input:

37 50
3 13 800000000 1486504444
13 15 370585303
1 22 512800722
14 27 106885266
10 16 725594291
30 36 108956774
19 36 433628006
1 12 545984301
27 35 189360159
12 16 664402534
11 12 380504104
1 8 45728948
13 28 515146903
1 32 940614835
17 25 645491830
9 29 807839266
8 34 332046289
13 34 338976005
18 2...

output:

666

result:

ok single line: '666'

Subtask #3:

score: 29
Accepted

Dependency #2:

100%
Accepted

Test #48:

score: 29
Accepted
time: 2ms
memory: 11228kb

input:

77 2926
15 52 27443170 55437463
40 66 884970624
46 62 148260852
5 67 711213444
37 57 407386525
3 73 782822297
15 24 993934552
2 14 894478216
45 49 950454850
15 62 211244372
57 58 748597691
31 53 528827244
21 63 162292047
35 39 8468495
6 17 772380575
11 23 826919554
4 33 795485582
48 77 951290021
1 5...

output:

2926

result:

ok single line: '2926'

Test #49:

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

input:

3000 1500
1585 2733 853417396 31014668872
205 2294 677175644
315 1437 460335775
2677 2747 966733810
1927 2729 282640164
1549 1836 111230221
1099 1101 337219213
1483 1561 444444957
2072 2797 796173172
1802 2659 336835010
1190 1555 82345077
1492 2715 924926863
1406 1629 399624633
370 412 537502164
206...

output:

1

result:

ok single line: '1'

Test #50:

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

input:

3000 3000
10 903 639468436 4812743596
227 1344 926811751
1919 1949 837083439
228 638 141284653
2137 2481 840777783
667 885 983425115
527 2975 541524579
1937 2752 777540325
48 1745 951895032
1146 2285 865318421
247 2247 524068937
347 2846 407037626
1074 2949 229857419
611 1217 169780190
1810 2031 604...

output:

4303

result:

ok single line: '4303'

Test #51:

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

input:

3000 3000
1141 2362 235601608 29034840309
1741 2548 75242545
868 1358 157029860
708 1793 182150282
571 2794 648800173
100 1815 496177778
2174 2439 738541998
1962 2024 882029519
1031 1853 773454049
1215 1644 424709187
1946 2763 479842947
683 2326 461077188
2487 2608 781511670
1497 2455 390810057
1034...

output:

2376

result:

ok single line: '2376'

Test #52:

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

input:

2950 3000
151 2265 1 70014788174
164 2476 707887851
1632 1726 595040900
392 659 904043903
1915 1924 789052293
604 2109 374673225
1053 1779 686551750
914 2920 64920893
337 574 468348212
148 186 873307341
295 2310 89340476
209 682 90871431
113 2174 87826441
817 2025 365339356
1597 1907 399842642
1972 ...

output:

473752

result:

ok single line: '473752'

Test #53:

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

input:

3000 3000
2320 2570 1 680489405665
1015 2002 860672629
1417 1713 901417954
1322 2833 906064194
1982 2390 783831242
1530 1601 309730179
1256 1316 592667195
1121 1855 830334998
1188 2494 400513385
446 1770 170304589
477 2022 639234245
337 2902 225422866
330 2036 271553221
659 776 293406851
395 2757 21...

output:

2540588

result:

ok single line: '2540588'

Test #54:

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

input:

3000 2999
1425 2355 595313768 232333375519
1 2 23740312
2 3 868240697
3 4 678422653
4 5 470112241
5 6 287865697
6 7 795471532
7 8 515973225
8 9 676155032
9 10 129913532
10 11 512705401
11 12 156951202
12 13 260465388
13 14 852576523
14 15 472285618
15 16 275211045
16 17 382241208
17 18 457235581
18 ...

output:

429106

result:

ok single line: '429106'

Test #55:

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

input:

3000 2999
24 630 489717827 152590938397
1 2 156023787
2 3 632369519
3 4 599104976
4 5 547934290
5 6 213249600
6 7 367076117
7 8 594980655
8 9 428235794
9 10 94512657
10 11 574535841
11 12 4815945
12 13 404101641
13 14 828498741
14 15 149032176
15 16 43195102
16 17 49501417
17 18 71553666
18 19 56386...

output:

102293

result:

ok single line: '102293'

Test #56:

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

input:

77 2926
15 52 27443170 55161901
40 66 884970624
46 62 148260852
5 67 711213444
37 57 407386525
3 73 782822297
15 24 993934552
2 14 894478216
45 49 950454850
15 62 211244372
57 58 748597691
31 53 528827244
21 63 162292047
35 39 8468495
6 17 772380575
11 23 826919554
4 33 795485582
48 77 951290021
1 5...

output:

34

result:

ok single line: '34'

Test #57:

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

input:

3000 1500
1585 2733 853417396 913559014668872
205 2294 677175644
315 1437 460335775
2677 2747 966733810
1927 2729 282640164
1549 1836 111230221
1099 1101 337219213
1483 1561 444444957
2072 2797 796173172
1802 2659 336835010
1190 1555 82345077
1492 2715 924926863
1406 1629 399624633
370 412 537502164...

output:

1

result:

ok single line: '1'

Test #58:

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

input:

3000 3000
10 903 639468436 3211533151
227 1344 926811751
1919 1949 837083439
228 638 141284653
2137 2481 840777783
667 885 983425115
527 2975 541524579
1937 2752 777540325
48 1745 951895032
1146 2285 865318421
247 2247 524068937
347 2846 407037626
1074 2949 229857419
611 1217 169780190
1810 2031 604...

output:

253

result:

ok single line: '253'

Test #59:

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

input:

3000 3000
1141 2362 235601608 524309034840309
1741 2548 75242545
868 1358 157029860
708 1793 182150282
571 2794 648800173
100 1815 496177778
2174 2439 738541998
1962 2024 882029519
1031 1853 773454049
1215 1644 424709187
1946 2763 479842947
683 2326 461077188
2487 2608 781511670
1497 2455 390810057
...

output:

2376

result:

ok single line: '2376'

Test #60:

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

input:

3000 2999
2355 2768 445337968 951809992
1 1312 868240697
2 1312 678422653
3 1312 470112241
4 1312 287865697
5 1312 795471532
6 1312 515973225
7 1312 676155032
8 1312 129913532
9 1312 512705401
10 1312 156951202
11 1312 260465388
12 1312 852576523
13 1312 472285618
14 1312 275211045
15 1312 382241208...

output:

976

result:

ok single line: '976'

Test #61:

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

input:

3000 2999
630 1827 78958062 535102127
1 2787 632369519
2 2787 599104976
3 2787 547934290
4 2787 213249600
5 2787 367076117
6 2787 594980655
7 2787 428235794
8 2787 94512657
9 2787 574535841
10 2787 4815945
11 2787 404101641
12 2787 828498741
13 2787 149032176
14 2787 43195102
15 2787 49501417
16 278...

output:

427

result:

ok single line: '427'

Test #62:

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

input:

1502 2998
1 1502 60615603 60616185
2 3 2
3 1501 999999994
2 4 3
4 1501 999999992
2 5 4
5 1501 999999990
2 6 5
6 1501 999999988
2 7 6
7 1501 999999986
2 8 7
8 1501 999999984
2 9 8
9 1501 999999982
2 10 9
10 1501 999999980
2 11 10
11 1501 999999978
2 12 11
12 1501 999999976
2 13 12
13 1501 999999974
2...

output:

1163

result:

ok single line: '1163'

Test #63:

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

input:

1502 2998
1 1502 462744981 462745160
2 3 2
3 1501 999999994
2 4 3
4 1501 999999992
2 5 4
5 1501 999999990
2 6 5
6 1501 999999988
2 7 6
7 1501 999999986
2 8 7
8 1501 999999984
2 9 8
9 1501 999999982
2 10 9
10 1501 999999980
2 11 10
11 1501 999999978
2 12 11
12 1501 999999976
2 13 12
13 1501 999999974...

output:

357

result:

ok single line: '357'

Test #64:

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

input:

2001 3000
225 1222 1 6
1 2 3
2 3 4
3 4 6
4 5 10
5 6 18
6 7 34
7 8 66
8 9 130
9 10 258
10 11 514
11 12 1026
12 13 2050
13 14 4098
14 15 8194
15 16 16386
16 17 32770
17 18 65538
18 19 131074
19 20 262146
20 21 524290
21 22 1048578
22 23 2097154
23 24 4194306
24 25 8388610
25 26 16777218
26 27 33554434...

output:

61

result:

ok single line: '61'

Test #65:

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

input:

2001 3000
999 1986 7 18
1 2 3
2 3 4
3 4 6
4 5 10
5 6 18
6 7 34
7 8 66
8 9 130
9 10 258
10 11 514
11 12 1026
12 13 2050
13 14 4098
14 15 8194
15 16 16386
16 17 32770
17 18 65538
18 19 131074
19 20 262146
20 21 524290
21 22 1048578
22 23 2097154
23 24 4194306
24 25 8388610
25 26 16777218
26 27 3355443...

output:

216

result:

ok single line: '216'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%