TopCoder

User's AC Ratio

33.3% (1/3)

Submission's AC Ratio

20.0% (1/5)

Tags

Description

Input Format

Output Format

Sample Input 1

1 2
1
2
0 1 1
1 1 1

Sample Output 1

2

Sample Input 2

3 7
3 3 3
6 1 2
0 2 3
1 2 2
1 1 3
0 2 3
0 1 1
1 1 1
1 2 3

Sample Output 2

1
6
6
6

Sample Input 3

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

Sample Output 3

40
9

Hints

Problem Source

YTP 2021 國中組程式挑戰營 p10

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 0~8 $N, M \leq 1000$ 8
3 0~17 無額外限制 12

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 5000 262144 65536 1 2 3
1 5000 262144 65536 1 2 3
2 5000 262144 65536 1 2 3
3 5000 262144 65536 2 3
4 5000 262144 65536 2 3
5 5000 262144 65536 2 3
6 5000 262144 65536 2 3
7 5000 262144 65536 2 3
8 5000 262144 65536 2 3
9 5000 262144 65536 3
10 5000 262144 65536 3
11 5000 262144 65536 3
12 5000 262144 65536 3
13 5000 262144 65536 3
14 5000 262144 65536 3
15 5000 262144 65536 3
16 5000 262144 65536 3
17 5000 262144 65536 3