1 题目描述
A team of $k (1 <= K <= 100) $workers should paint a fence which contains N ( 1 < = N < = 16000 ) N (1 <= N <= 16 000) N(1<=N<=16000) planks numbered from 1 1 1 to N N N from left to right. Each worker i ( 1 < = i < = K ) i (1 <= i <= K) i(1<=i<=K) should sit in front of the plank S i S_i Si and he may paint only a compact interval (this means that the planks from the interval should be consecutive). This interval should contain the Si plank. Also a worker should not paint more than Li planks and for each painted plank he should receive P i ( 1 < = P i < = 10000 ) P_i (1 <= P_i <= 10 000) Pi(1<=Pi<=10000). A plank should be painted by no more than one worker. All the numbers Si should be distinct.
Being the team’s leader you want to determine for each worker the interval that he should paint, knowing that the total income should be maximal. The total income represents the sum of the workers personal income.
Write a program that determines the total maximal income obtained by the K workers.
有 N N N 块木板从左至右排成一行,有 K