Company: Typeface_26july
Difficulty: medium
Minimum Complexity Level Problem Description Alex is attending a software engineering conference at which a number of lectures are presented. Every lecture has a complexity. Alex has already fixed the order in which the lectures will be attended, and now has to spread that fixed sequence over the days days the conference runs. Alex must attend at least one lecture on every day, and the lectures attended on one day must form a consecutive block of the planned order - the planned order is never rearranged. The complexity of a day is the complexity of the most complex lecture attended on that day, and the overall complexity of the conference is the sum of the daily complexities. Given the complexity of every lecture in the order they must be attended, and the number of days, determine the smallest overall complexity that can be achieved. Input Format Input is read from standard input. The first line contains a single integer n , the number of lectures. Each of the next n lines contains a