Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Cut the Sequence
Description Given an integer sequence { N, you are to cut the sequence into several parts every one of which is a consecutive subsequence of the original sequence. Every part must satisfy that the sum of the integers in the part is not greater than a given integer M. You are to find a cutting that minimizes the sum of the maximum integer of each part.Input The first line of input contains two integer Output Output one integer which is the minimum sum of the maximum integer of each part. If no such cuttings exist, output −1. Sample Input 8 17 2 2 2 8 1 8 2 1 Sample Output 12 Hint Use 64-bit integer type to hold Source POJ Monthly--2006.09.29, zhucheng |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator