Connecting Cities
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Connecting Cities
题目描述
有 个点排成一行,在第 个点之间连边的代价为 ,求将它们连成一棵树的最小代价。
输入格式
第一行两个整数 。
第二行 个整数 。
输出格式
输出一个整数表示答案。
样例 #1
样例输入 #1
3 1
1 100 1
样例输出 #1
106
样例 #2
样例输入 #2
3 1000
1 100 1
样例输出 #2
2202
样例 #3
样例输入 #3
6 14
25 171 7 1 17 162
样例输出 #3
497
样例 #4
样例输入 #4
12 5
43 94 27 3 69 99 56 25 8 15 46 8
样例输出 #4
658
数据范围
20240528集训
- Status
- Done
- Rule
- IOI
- Problem
- 6
- Start at
- 2024-5-28 19:00
- End at
- 2024-5-28 21:00
- Duration
- 2 hour(s)
- Host
- Partic.
- 16