#C3938. Fruits and Bowls
Fruits and Bowls
Fruits and Bowls
You are given n bowls and m fruits. Each bowl has a capacity and each fruit has a weight. A bowl can hold at most one fruit, and a fruit can only be placed in a bowl if its weight does not exceed the bowl's capacity. In other words, a fruit with weight \(w\) can be placed into a bowl with capacity \(c\) only if \(w \le c\).
Your task is to determine the maximum number of fruits that can be placed into the bowls under these constraints.
Input is read from stdin and the result is printed to stdout.
inputFormat
The input consists of three lines:
- The first line contains two integers \(n\) and \(m\) separated by space, representing the number of bowls and fruits respectively.
- The second line contains \(n\) integers representing the capacities of the bowls.
- The third line contains \(m\) integers representing the weights of the fruits.
outputFormat
A single integer representing the maximum number of fruits that can be placed into the bowls.
## sample4 5
3 5 7 9
2 4 6 8 10
4