#P7793. [COCI 2014/2015 #7] ACM
[COCI 2014/2015 #7] ACM
Background
Team members Stjepan, Ivan, and Gustav from the University of Zagreb are in Morocco attending the ACM International Collegiate Programming Contest World Finals. Their coach Goran has come up with an unbeatable strategy for solving the problems in the finals.
Problem Description
At the beginning, each team member quickly estimates the difficulty of each of the problems. These difficulties are described by numbers from to ; the larger the number, the harder the problem.
After that, they will divide the work among themselves. For simplicity, the set of problems will be split into three parts, so that each team member gets a non-empty consecutive segment of problems to think about. The division is made to minimize the sum of estimated difficulties, counting only the estimated difficulty values given by the team member who is assigned that segment. Your task is to compute this minimum possible total sum.
Input Format
The input consists of four lines.
The first line contains an integer , the number of problems.
Lines 2 to 4: on line there are integers , where is member 's estimated difficulty for problem .
Output Format
Output a single line containing one integer, the minimum possible total estimated difficulty sum.
3
1 3 3
1 1 1
1 2 3
4
7
3 3 4 1 3 4 4
4 2 5 1 5 5 4
5 5 1 3 4 4 4
19
Hint
[Sample 1 Explanation]
Assign problem to member , assign problem to member , and assign problem to member . Then the total difficulty sum is . It can be proven that no assignment has a smaller total difficulty sum.
[Constraints]
For all testdata, , .
[Source]
This problem is from COCI 2014-2015 CONTEST 7 T3 ACM, and follows the original testdata configuration, with a full score of points.
Translated and整理 (zhengli) provided by Eason_AC.
Translated by ChatGPT 5