TopCoder

Caido
主唱太拼命了

User's AC Ratio

90.0% (18/20)

Submission's AC Ratio

50.9% (29/57)

Tags

Description

Input Format

Output Format

Sample Input 1

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

Sample Output 1

8
10
8
8
10
9

Sample Input 2

2 1
2 1 48763

Sample Output 2

48763

Sample Input 3

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

Sample Output 3

16
11
15
11
14
18
19
13
13
11
13
11
17
13
11

Hints

Problem Source

YTP 2024 高中組初賽 p8

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 0~7 $M \leq N + 20$ 2
3 0~2, 8~13 $N \leq 2000$ 2
4 0~2, 8~19 $N \leq 50000$ 6
5 0~25 無額外限制 10

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 2500 1048576 65536 1 2 3 4 5
1 2500 1048576 65536 1 2 3 4 5
2 2500 1048576 65536 1 2 3 4 5
3 2500 1048576 65536 2 5
4 2500 1048576 65536 2 5
5 2500 1048576 65536 2 5
6 2500 1048576 65536 2 5
7 2500 1048576 65536 2 5
8 2500 1048576 65536 3 4 5
9 2500 1048576 65536 3 4 5
10 2500 1048576 65536 3 4 5
11 2500 1048576 65536 3 4 5
12 2500 1048576 65536 3 4 5
13 2500 1048576 65536 3 4 5
14 2500 1048576 65536 4 5
15 2500 1048576 65536 4 5
16 2500 1048576 65536 4 5
17 2500 1048576 65536 4 5
18 2500 1048576 65536 4 5
19 2500 1048576 65536 4 5
20 2500 1048576 65536 5
21 2500 1048576 65536 5
22 2500 1048576 65536 5
23 2500 1048576 65536 5
24 2500 1048576 65536 5
25 2500 1048576 65536 5