#P7842. 「C.E.L.U-03」探险者笔记 III
「C.E.L.U-03」探险者笔记 III
Description
The remade Explorer's Notes consists of levels. Each level has a difficulty . There are also achievements. The -th achievement requires you to complete exactly levels, and they must be exactly . Completing the -th achievement gives you a score of .
If you push levels for a long time without getting any achievement, Xiao Soup will feel tired. Also, achievements must be unlocked in a certain order. Therefore, if the last obtained achievement is the -th one, then the condition to obtain the -th achievement next is: and $w+\sum\limits_{k=1}^{sum_i} b_{a_{i_k}} \ge \sum\limits_{k=1}^{sum_j} b_{a_{j_k}}$, where is a given constant.
There are no restrictions for obtaining the first achievement. Find the maximum total score he can get.
Input Format
The first line contains three numbers .
The second line contains numbers .
The next lines describe the achievements. In the -th line, the first two numbers are , followed by numbers .
Output Format
Only one number, the answer.
3 3 1
1 1 2
2 1 1
2 2 1 2
3 2 1 3
4
4 6 2
1 1 3 2
3 3 1 2 3
2 2 2 3
3 3 2 3 4
2 2 1 3
4 3 1 3 4
6 4 1 2 3 4
12
Hint
Sample Explanation
Sample Explanation 1
Complete achievements in order.
Sample Explanation 2
Complete achievements in order. Note that the restriction between achievements only takes effect between two adjacent obtained achievements.
Constraints
| Testdata ID | ||
|---|---|---|
For of the testdata: , , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号