I Don't Want to Work
Time limit1sMemory limit1024 MB
Given N farm cells, M days, and K fruit types with first-harvest time, regrow time, and sale price, find the maximum money earned by day M.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Greedy
- Solved
- No attempts yet
Problem
Farmer Jay owns a farm with cells and wants to grow various fruits from day to day .
Each day, Jay can do the following at any cell.
- Plant a seed. If the cell already has a fruit, remove it and plant a new seed.
- Harvest a fruit.
Jay can grow kinds of fruit. The information for the -th kind is as follows.
- It takes days for a seed to grow and bear its first fruit.
- After a harvest, the fruit grows back after days.
- Each harvest yields one fruit, and selling a fruit earns money.
Jay wants to earn as much money as possible.
Jay can do as much work as desired each day, and has plenty of seeds of each fruit.
Input
The first line contains , , and separated by spaces.
The next lines contain , , and for the -th fruit, separated by spaces.
Output
Print the maximum money Jay can earn by day .