P6967 [NEERC 2016] Delight for a Cat

题目描述

A cat is going on an adventure. Each hour, the cat can be either sleeping or eating. The cat cannot be doing both actions at the same hour, and the cat is doing exactly one of these actions for the whole hour. For each of the next $n$ hours, the amount of delight the cat is getting if it is sleeping or eating during that hour is known. These amounts can be different for each hour. An integer time period $k$ is also known. Among every $k$ consecutive hours, there should be at least $m_{s}$ hours when the cat is sleeping, and at least $m_{e}$ hours when the cat is eating. So, there are exactly $n − k + 1$ segments of $k$ hours for which this condition must be satisfied. Find the maximum total amount of delight the cat can get during the next $n$ hours.

输入格式

输出格式

说明/提示

Time limit: 2 s, Memory limit: 512 MB.