TopCoder

User's AC Ratio

100.0% (11/11)

Submission's AC Ratio

81.2% (13/16)

Description

Input Format

Output Format

Sample Input

// Sample input 1
5 3
1 11
2 7
1 5
2 3
1 2

// Sample input 2
8 13
9 5
1 7
2 9
5 8
5 2
7 10
3 2
6 3

Sample Output

// Sample output 1
25

// Sample output 2
120

Hints

Problem Source

109 學年度全國資訊學科能力競賽

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資。 0
2 2~12 輸入滿足 $p_1 \ge p_2 \ge \cdots \ge p_n$。 50
3 13~23 無額外限制。 50

Testdata and Limits

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