4605: Select elements

内存限制:128 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:Special Judge 上传者:
提交:3 通过:1

题目描述

Given an integer sequence a1, a2, ..., an with a length of n. 
Please select x elements from it, satisfying the following conditions: 
Every consecutive subsequence of length k in the original sequence must contain at least one selected element. 
With the condition 1 satisfied, the sum of the x selected elements should be maximized. 
Output the maximum possible sum.

输入格式

The first line contains three integers n, k, and x. The second line contains n integers a1, a2, ..., an.

输出格式

If it is not possible to meet the requirements of the problem, output -1. Otherwise, output an integer representing the maximum possible sum of the selected elements.

输入样例 复制

5 2 3
5 1 3 10 1

输出样例 复制

18

数据范围与提示

1≤k,x≤n≤200 1≤ai≤109