QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#544412#8256. Construction Project 2ZhangYiDe8 171ms23844kbC++172.0kb2024-09-02 16:21:132024-09-02 16:21:15

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 2ms
memory: 13776kb

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: 8
Accepted
time: 2ms
memory: 13784kb

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: 8
Accepted
time: 0ms
memory: 12488kb

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: 8
Accepted
time: 0ms
memory: 11412kb

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
Accepted
time: 113ms
memory: 23596kb

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:

160035

result:

ok single line: '160035'

Test #6:

score: 8
Accepted
time: 129ms
memory: 23560kb

input:

200000 159789
156039 195320 1 2
3 195320 1
4 156039 1
6 156039 1
8 195320 1
10 195320 1
12 156039 1
13 195320 1
14 195320 1
15 195320 1
17 156039 1
20 195320 1
22 195320 1
23 156039 1
24 195320 1
27 156039 1
28 195320 1
29 195320 1
30 195320 1
31 195320 1
32 156039 1
33 195320 1
34 195320 1
35 19532...

output:

159786

result:

ok single line: '159786'

Test #7:

score: 8
Accepted
time: 92ms
memory: 22732kb

input:

200000 159948
96296 139890 1 2
1 139890 1
2 139890 1
3 139890 1
4 96296 1
5 139890 1
6 139890 1
7 139890 1
8 139890 1
9 96296 1
10 96296 1
11 96296 1
12 139890 1
14 96296 1
15 139890 1
16 96296 1
18 96296 1
20 96296 1
21 139890 1
24 139890 1
26 139890 1
27 139890 1
28 96296 1
29 96296 1
30 139890 1
...

output:

19999900000

result:

ok single line: '19999900000'

Test #8:

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

input:

50 25
8 15 1 2
39 40 1
11 26 1
4 27 1
7 29 1
12 24 1
27 42 1
26 49 1
27 35 1
31 39 1
15 37 1
9 30 1
3 23 1
10 43 1
2 9 1
8 12 1
6 27 1
35 36 1
25 50 1
41 47 1
18 27 1
15 31 1
5 6 1
3 25 1
38 49 1
1 37 1

output:

4

result:

ok single line: '4'

Test #9:

score: 8
Accepted
time: 2ms
memory: 12528kb

input:

50 50
33 37 1 2
32 50 1
12 14 1
4 11 1
12 42 1
44 48 1
21 46 1
14 36 1
20 34 1
10 50 1
5 45 1
10 36 1
13 32 1
9 29 1
14 21 1
14 42 1
10 39 1
34 47 1
3 22 1
16 39 1
9 49 1
7 27 1
1 11 1
23 29 1
18 23 1
22 48 1
14 32 1
28 32 1
10 24 1
2 4 1
11 15 1
37 44 1
22 46 1
3 33 1
35 50 1
14 19 1
19 43 1
23 37 ...

output:

5

result:

ok single line: '5'

Test #10:

score: 8
Accepted
time: 3ms
memory: 14012kb

input:

3000 1500
424 1182 1 2
2126 2364 1
1664 2582 1
2252 2664 1
80 2286 1
148 2474 1
658 812 1
739 2183 1
144 180 1
319 2084 1
805 1528 1
821 1049 1
439 1404 1
712 1397 1
193 2507 1
122 2957 1
1385 1844 1
1034 2527 1
113 567 1
521 2162 1
498 2042 1
1613 1947 1
2013 2743 1
2314 2697 1
2779 2898 1
205 2098...

output:

3

result:

ok single line: '3'

Test #11:

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

input:

3000 3000
1698 2777 1 2
1065 2115 1
1167 2496 1
694 2313 1
1379 1868 1
223 770 1
1970 2119 1
289 537 1
1194 2859 1
72 1064 1
2583 2883 1
1211 2103 1
622 1748 1
649 1532 1
1221 2083 1
767 1718 1
2239 2810 1
304 1889 1
1048 2729 1
92 322 1
584 2918 1
42 1998 1
160 542 1
866 1248 1
1829 2324 1
611 1443...

output:

4

result:

ok single line: '4'

Test #12:

score: 8
Accepted
time: 84ms
memory: 18228kb

input:

200000 100000
46706 69791 1 2
151808 156313 1
28022 37489 1
76906 125687 1
7808 163773 1
91420 174488 1
11314 168440 1
66409 168233 1
166631 173716 1
43439 101663 1
97615 162798 1
31889 169824 1
17638 194343 1
172947 192186 1
120411 196358 1
84695 196401 1
185433 198102 1
76328 85703 1
34215 159517 ...

output:

2

result:

ok single line: '2'

Test #13:

score: 8
Accepted
time: 171ms
memory: 23604kb

input:

200000 200000
108109 162827 1 2
49484 110100 1
2650 19925 1
195272 199535 1
192970 197399 1
9574 91823 1
91433 103939 1
25666 190641 1
82404 194272 1
7984 131610 1
112543 199959 1
25177 97169 1
145319 171345 1
126654 131029 1
106315 193835 1
117374 135540 1
17675 41269 1
18895 88212 1
102310 184232 ...

output:

5

result:

ok single line: '5'

Test #14:

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

input:

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

output:

4

result:

ok single line: '4'

Test #15:

score: 8
Accepted
time: 2ms
memory: 13304kb

input:

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

output:

5

result:

ok single line: '5'

Test #16:

score: 8
Accepted
time: 135ms
memory: 23084kb

input:

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

output:

5

result:

ok single line: '5'

Test #17:

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

input:

50 25
8 15 1 2
39 40 1
11 26 1
4 27 1
7 29 1
12 24 1
27 42 1
26 49 1
27 35 1
31 39 1
15 37 1
9 30 1
3 23 1
10 43 1
2 9 1
8 12 1
6 27 1
35 36 1
25 50 1
41 47 1
18 27 1
15 31 1
5 6 1
3 25 1
38 49 1
1 37 1

output:

4

result:

ok single line: '4'

Test #18:

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

input:

50 50
33 37 1 2
32 50 1
12 14 1
4 11 1
12 42 1
44 48 1
21 46 1
14 36 1
20 34 1
10 50 1
5 45 1
10 36 1
13 32 1
9 29 1
14 21 1
14 42 1
10 39 1
34 47 1
3 22 1
16 39 1
9 49 1
7 27 1
1 11 1
23 29 1
18 23 1
22 48 1
14 32 1
28 32 1
10 24 1
2 4 1
11 15 1
37 44 1
22 46 1
3 33 1
35 50 1
14 19 1
19 43 1
23 37 ...

output:

5

result:

ok single line: '5'

Test #19:

score: 8
Accepted
time: 3ms
memory: 14032kb

input:

3000 1500
424 1182 1 2
2126 2364 1
1664 2582 1
2252 2664 1
80 2286 1
148 2474 1
658 812 1
739 2183 1
144 180 1
319 2084 1
805 1528 1
821 1049 1
439 1404 1
712 1397 1
193 2507 1
122 2957 1
1385 1844 1
1034 2527 1
113 567 1
521 2162 1
498 2042 1
1613 1947 1
2013 2743 1
2314 2697 1
2779 2898 1
205 2098...

output:

3

result:

ok single line: '3'

Test #20:

score: 8
Accepted
time: 4ms
memory: 13932kb

input:

3000 3000
1698 2777 1 2
1065 2115 1
1167 2496 1
694 2313 1
1379 1868 1
223 770 1
1970 2119 1
289 537 1
1194 2859 1
72 1064 1
2583 2883 1
1211 2103 1
622 1748 1
649 1532 1
1221 2083 1
767 1718 1
2239 2810 1
304 1889 1
1048 2729 1
92 322 1
584 2918 1
42 1998 1
160 542 1
866 1248 1
1829 2324 1
611 1443...

output:

4

result:

ok single line: '4'

Test #21:

score: 8
Accepted
time: 85ms
memory: 20208kb

input:

200000 100000
46706 69791 1 2
151808 156313 1
28022 37489 1
76906 125687 1
7808 163773 1
91420 174488 1
11314 168440 1
66409 168233 1
166631 173716 1
43439 101663 1
97615 162798 1
31889 169824 1
17638 194343 1
172947 192186 1
120411 196358 1
84695 196401 1
185433 198102 1
76328 85703 1
34215 159517 ...

output:

2

result:

ok single line: '2'

Test #22:

score: 8
Accepted
time: 167ms
memory: 23448kb

input:

200000 200000
108109 162827 1 2
49484 110100 1
2650 19925 1
195272 199535 1
192970 197399 1
9574 91823 1
91433 103939 1
25666 190641 1
82404 194272 1
7984 131610 1
112543 199959 1
25177 97169 1
145319 171345 1
126654 131029 1
106315 193835 1
117374 135540 1
17675 41269 1
18895 88212 1
102310 184232 ...

output:

5

result:

ok single line: '5'

Test #23:

score: 8
Accepted
time: 2ms
memory: 10884kb

input:

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

output:

1225

result:

ok single line: '1225'

Test #24:

score: 8
Accepted
time: 3ms
memory: 11184kb

input:

3000 2999
595 1315 1 2
1 595 1
2 595 1
3 595 1
4 595 1
5 595 1
6 595 1
7 595 1
8 595 1
9 595 1
10 595 1
11 595 1
12 595 1
13 595 1
14 595 1
15 595 1
16 595 1
17 595 1
18 595 1
19 595 1
20 595 1
21 595 1
22 595 1
23 595 1
24 595 1
25 595 1
26 595 1
27 595 1
28 595 1
29 595 1
30 595 1
31 595 1
32 595 ...

output:

4498500

result:

ok single line: '4498500'

Test #25:

score: 8
Accepted
time: 102ms
memory: 23844kb

input:

200000 199999
103332 117336 1 2
1 174713 1
2 174713 1
3 174713 1
4 174713 1
5 174713 1
6 174713 1
7 174713 1
8 174713 1
9 174713 1
10 174713 1
11 174713 1
12 174713 1
13 174713 1
14 174713 1
15 174713 1
16 174713 1
17 174713 1
18 174713 1
19 174713 1
20 174713 1
21 174713 1
22 174713 1
23 174713 1
2...

output:

19999900000

result:

ok single line: '19999900000'

Test #26:

score: 8
Accepted
time: 95ms
memory: 19616kb

input:

100002 199998
1 100002 1 2
2 3 1
3 100001 1
2 4 1
4 100001 1
2 5 1
5 100001 1
2 6 1
6 100001 1
2 7 1
7 100001 1
2 8 1
8 100001 1
2 9 1
9 100001 1
2 10 1
10 100001 1
2 11 1
11 100001 1
2 12 1
12 100001 1
2 13 1
13 100001 1
2 14 1
14 100001 1
2 15 1
15 100001 1
2 16 1
16 100001 1
2 17 1
17 100001 1
2 ...

output:

3

result:

ok single line: '3'

Test #27:

score: 8
Accepted
time: 118ms
memory: 21052kb

input:

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

output:

9

result:

ok single line: '9'

Subtask #2:

score: 0
Wrong Answer

Test #28:

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

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
Wrong Answer
time: 2ms
memory: 13144kb

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:

1

result:

wrong answer 1st lines differ - expected: '4', found: '1'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%