report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Cucumber - FlandreOJ: Flandre Online Judge

Cucumber

Time limit: 1000 ms
Memory limit: 256 MB
Nitori's cucumber garden has $n$ cucumbers that need to be harvested. Harvesting a cucumber requires exactly one unit of time, and the $i$-th cucumber needs to be harvested before time $a_i$. Not harvesting the $i$-th cucumber will incur a loss of $b_i$. Help Nitori harvest the cucumbers in an optimal order to minimize the loss. ### Input - The first line contains two integers $n$. - The second line contains $n$ integers $a_i$. - The third line contains $n$ integers $b_i$. ### Output - Print an integer, the minimum loss. ### Constraints - $1 \leq n \leq 1000$. - $1 \leq a_i, b_i \leq 1000$. ### Example Input: ``` 5 1 3 2 3 1 10 40 30 20 15 ``` Output: ``` 25 ```
Sorting
Points Sorting
Brewing potion
Smallest possible
Distance minimization
Segment
Cucumber
Maximum value arrangement
Buttons game
Building fence
Balance
Topic
Sorting
Rating 1000
Solution (1) Solution