#P8803. [蓝桥杯 2022 国 B] 费用报销
[蓝桥杯 2022 国 B] 费用报销
Problem Description
After finishing a business trip, Xiaoming returned to the city where the company is located. When filling out the travel reimbursement application, careless Xiaoming found that he lost the receipts from the trip.
To make up for Xiaoming’s loss, the company agrees that Xiaoming can use other receipts for reimbursement. However, the finance department requires that, among the receipts Xiaoming submits, the date difference between any two receipts must be at least days, and the total amount must not exceed the actual travel cost .
For example, when the finance department requires , if Xiaoming submits a receipt dated January 8, then he cannot submit any other receipt dated from January 2 to January 14. Receipts dated January 1 or earlier, and January 15 or later, can be submitted.
Xiaoming’s colleagues collected receipts for him. Now Xiaoming wants you to help him organize them: choose a set of receipts that satisfies the finance requirements, and make the total amount as close to as possible.
Note that since all these receipts are from the same year, receipts at the end of December will not affect whether receipts at the beginning of January can be submitted. This year is not a leap year.
Input Format
Line : integers, .
Lines : each line contains integers . Line describes the -th receipt: its month , day , and face value .
Output Format
Line : integer, the maximum total reimbursement amount Xiaoming can achieve.
4 16 3
1 1 1
1 3 2
1 4 4
1 6 8
10
Hint
Sample Explanation
Choose the receipts dated January 3 and January 6.
Test Case Scale and Constraints
For of the test cases, $1 \leq N \leq 1000, 1 \leq M \leq 5000, 1 \leq K \leq 50, 1 \leq m_{i} \leq 12, 1 \leq d_{i} \leq 31, 1 \leq v_{i} \leq 400$.
The dates are guaranteed to be valid.
Lanqiao Cup 2022 National Contest, Group B, Problem F.
Translated by ChatGPT 5