TopCoder

Caido
$\mathbb{W}\mathcal{aimai}\sim$

User's AC Ratio

85.7% (36/42)

Submission's AC Ratio

27.2% (47/173)

Tags

Description

Input Format

Output Format

Sample Input 1

3 4
2 2 1
2 4

Sample Output 1

3

Sample Input 2

4 5
3 3 3
1 3 4

Sample Output 2

6

Hints

Problem Source

2024 TOI 初選
測資來源:TWPCA GitHub

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 0~31 輸入滿足 $m, n \le 1000$ 11
3 0~61 輸入滿足 $m, n \le 10^ 5$ 41
4 0~91 無額外限制 48

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 1048576 65536 1 2 3 4
1 1000 1048576 65536 1 2 3 4
2 1000 1048576 65536 2 3 4
3 1000 1048576 65536 2 3 4
4 1000 1048576 65536 2 3 4
5 1000 1048576 65536 2 3 4
6 1000 1048576 65536 2 3 4
7 1000 1048576 65536 2 3 4
8 1000 1048576 65536 2 3 4
9 1000 1048576 65536 2 3 4
10 1000 1048576 65536 2 3 4
11 1000 1048576 65536 2 3 4
12 1000 1048576 65536 2 3 4
13 1000 1048576 65536 2 3 4
14 1000 1048576 65536 2 3 4
15 1000 1048576 65536 2 3 4
16 1000 1048576 65536 2 3 4
17 1000 1048576 65536 2 3 4
18 1000 1048576 65536 2 3 4
19 1000 1048576 65536 2 3 4
20 1000 1048576 65536 2 3 4
21 1000 1048576 65536 2 3 4
22 1000 1048576 65536 2 3 4
23 1000 1048576 65536 2 3 4
24 1000 1048576 65536 2 3 4
25 1000 1048576 65536 2 3 4
26 1000 1048576 65536 2 3 4
27 1000 1048576 65536 2 3 4
28 1000 1048576 65536 2 3 4
29 1000 1048576 65536 2 3 4
30 1000 1048576 65536 2 3 4
31 1000 1048576 65536 2 3 4
32 1000 1048576 65536 3 4
33 1000 1048576 65536 3 4
34 1000 1048576 65536 3 4
35 1000 1048576 65536 3 4
36 1000 1048576 65536 3 4
37 1000 1048576 65536 3 4
38 1000 1048576 65536 3 4
39 1000 1048576 65536 3 4
40 1000 1048576 65536 3 4
41 1000 1048576 65536 3 4
42 1000 1048576 65536 3 4
43 1000 1048576 65536 3 4
44 1000 1048576 65536 3 4
45 1000 1048576 65536 3 4
46 1000 1048576 65536 3 4
47 1000 1048576 65536 3 4
48 1000 1048576 65536 3 4
49 1000 1048576 65536 3 4
50 1000 1048576 65536 3 4
51 1000 1048576 65536 3 4
52 1000 1048576 65536 3 4
53 1000 1048576 65536 3 4
54 1000 1048576 65536 3 4
55 1000 1048576 65536 3 4
56 1000 1048576 65536 3 4
57 1000 1048576 65536 3 4
58 1000 1048576 65536 3 4
59 1000 1048576 65536 3 4
60 1000 1048576 65536 3 4
61 1000 1048576 65536 3 4
62 1000 1048576 65536 4
63 1000 1048576 65536 4
64 1000 1048576 65536 4
65 1000 1048576 65536 4
66 1000 1048576 65536 4
67 1000 1048576 65536 4
68 1000 1048576 65536 4
69 1000 1048576 65536 4
70 1000 1048576 65536 4
71 1000 1048576 65536 4
72 1000 1048576 65536 4
73 1000 1048576 65536 4
74 1000 1048576 65536 4
75 1000 1048576 65536 4
76 1000 1048576 65536 4
77 1000 1048576 65536 4
78 1000 1048576 65536 4
79 1000 1048576 65536 4
80 1000 1048576 65536 4
81 1000 1048576 65536 4
82 1000 1048576 65536 4
83 1000 1048576 65536 4
84 1000 1048576 65536 4
85 1000 1048576 65536 4
86 1000 1048576 65536 4
87 1000 1048576 65536 4
88 1000 1048576 65536 4
89 1000 1048576 65536 4
90 1000 1048576 65536 4
91 1000 1048576 65536 4