TopCoder

餘切
me weak suggest teach

User's AC Ratio

80.0% (4/5)

Submission's AC Ratio

66.7% (18/27)

Tags

Description

Input Format

Output Format

Sample Input 1

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

Sample Output 1

3

Sample Input 2

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

Sample Output 2

1

Sample Input 3

10 0
6 5 5 5 0 3 4 6 6 6
6 4 5 7 10 7 10 7 3 0

Sample Output 3

22

Sample Input 4

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

Sample Output 4

6

Hints

Problem Source

2024 TOI 初選
測資來源:TWPCA GitHub

Subtasks

No. Testdata Range Constraints Score
1 0~3 範例測資 0
2 0~13 $n\le100$ 4
3 0~25 $n\le3000$ 10
4 0, 2, 26~32 $k=0$ 32
5 0~3, 33~40 $k\le20$ 25
6 0~48 無額外限制 29

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 4000 1048576 65536 1 2 3 4 5 6
1 4000 1048576 65536 1 2 3 5 6
2 4000 1048576 65536 1 2 3 4 5 6
3 4000 1048576 65536 1 2 3 5 6
4 4000 1048576 65536 2 3 6
5 4000 1048576 65536 2 3 6
6 4000 1048576 65536 2 3 6
7 4000 1048576 65536 2 3 6
8 4000 1048576 65536 2 3 6
9 4000 1048576 65536 2 3 6
10 4000 1048576 65536 2 3 6
11 4000 1048576 65536 2 3 6
12 4000 1048576 65536 2 3 6
13 4000 1048576 65536 2 3 6
14 4000 1048576 65536 3 6
15 4000 1048576 65536 3 6
16 4000 1048576 65536 3 6
17 4000 1048576 65536 3 6
18 4000 1048576 65536 3 6
19 4000 1048576 65536 3 6
20 4000 1048576 65536 3 6
21 4000 1048576 65536 3 6
22 4000 1048576 65536 3 6
23 4000 1048576 65536 3 6
24 4000 1048576 65536 3 6
25 4000 1048576 65536 3 6
26 4000 1048576 65536 4 6
27 4000 1048576 65536 4 6
28 4000 1048576 65536 4 6
29 4000 1048576 65536 4 6
30 4000 1048576 65536 4 6
31 4000 1048576 65536 4 6
32 4000 1048576 65536 4 6
33 4000 1048576 65536 5 6
34 4000 1048576 65536 5 6
35 4000 1048576 65536 5 6
36 4000 1048576 65536 5 6
37 4000 1048576 65536 5 6
38 4000 1048576 65536 5 6
39 4000 1048576 65536 5 6
40 4000 1048576 65536 5 6
41 4000 1048576 65536 6
42 4000 1048576 65536 6
43 4000 1048576 65536 6
44 4000 1048576 65536 6
45 4000 1048576 65536 6
46 4000 1048576 65536 6
47 4000 1048576 65536 6
48 4000 1048576 65536 6