题目描述
Problem description
Given N activities A=A1,A2,…,ANA=A1,A2,…,AN that wish to use a resource. Each activity AiAi uses the resource during interval [Si,Fi)[Si,Fi). The selection of activity AiAi yields a benefit of WiWi.
To select a collection of compatible activities to maximize benefits.
Algorithms or techniques
Dynamic programming
Input
Line1 : One integer NN refers to the total amount of tasks.
Line2 ~ Line N+1 : Three integers ss,ff, and ww refer to the start point, endpoint, and benefit for each task separately.
N<1e4N<1e4
Output
index for all choosed tasks, which is sorted as an ascending array.
Sample Input