ДОРЕШИВАНИЕ 2014 ACM-ICPC Украина, 2ой Раунд Украина, Сентябрь 13
Saucepans and lids
Great disaster happened this morning in the cafe where you used to have your snack in university. Larysa Ivanivna, the cleaner, while sweeping the floor dropped one of cupboards and all kitchenware stored there has scattered over the floor. Luckily, this cupboard contained only saucepans with lids. However, some items bent or broke, so has been disposed.
Now the schoolmaster wants to calculate losses and understand how many new saucepans and lids should be bought. First, she needs to find out how many remaining saucepans can be covered with remaining lids.
Saucepans and lids are round shaped. A lid can cover a saucepan if and only if radius of the lid is not less than radius of the saucepan.
The first line contains integers n, m (1 ≤ n, m ≤ 1000) – numbers of remaining saucepans and lids. The second line contains n integers
ai (1 ≤
ai ≤ 1000) – radii of remaining saucepans. The third line contains m integers
bi (1 ≤
bi ≤ 1000) – radii of remaining lids.
Print one integer – the maximum number of saucepans that can be covered by available lids.
5 5 4 8 1 2 5 7 2 4 6 5