410997: GYM104181 C Brownie Baking

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Brownie Bakingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output
One of Teddy's amazing cream cheese brownies

As Valentine's Day is coming up, Teddy is spending some time baking cream cheese brownies to give to their friends! Since Teddy is such a nice friend, they have taken requests from each of their $$$N$$$ friends as to how large of a brownie they would like to receive. A friend will be happy to receive a brownie larger than the size that they asked for.

Unfortunately, Teddy had not expected such an overwhelming number of requests (they are very popular), and so they are not sure that they will be able to accommodate everyone with their $$$M$$$ baking tins. Each of the baking tins that Teddy has have a specific volume of brownies that they can be used to bake, and moreover, each baking tin can only be used once. Finally, Teddy can only assign (at most) one baking tin per request, so the same baking tin cannot be used to create a larger brownie that would later be split into two (or more) pieces.

With all of this in mind, Teddy would still like to make it a very special Valentine's Day for their friends, and so they would like to maximize the number of friends who receive their desired amount (in units of volume) of brownies. Your job is to assist Teddy in calculating this value by assigning the baking tins optimally. Luckily for you, it's a rainy day out, so you have plenty of time to sit inside and code up an algorithm to assist Teddy.

Input

The input will begin with a line containing two space-separated integers, $$$N$$$ and $$$M$$$ ($$$1 \leq N, M \leq 2 \cdot 10^5$$$), representing the number of friends that requested brownies and the number of baking tins that Teddy has, respectively.

The next line will contain $$$N$$$ space-separated integers, $$$s_1, s_2, \dots, s_N$$$ ($$$1 \leq s_i \leq 2 \cdot 10^9$$$ for all $$$i \in \{1, 2, \dots, N\}$$$), where $$$s_i$$$ represents the size (in units of volume) of the brownie that Teddy's $$$i$$$-th friend requested.

The final line of input will contain $$$M$$$ space-separated integers, $$$t_1, t_2, \dots, t_M$$$ ($$$1 \leq t_i \leq 2 \cdot 10^9$$$ for all $$$i \in \{1, 2, \dots, M\}$$$), where $$$t_i$$$ represents the size (in units of volume) of the $$$i$$$-th baking tin that Teddy owns.

Output

The output should consist of a single line containing a single integer, the maximum number of Teddy's friends that can receive their desired size (or larger) of brownie, should Teddy pair the baking tins to requests optimally.

ExampleInput
5 3
8 12 25 3 10
1 8 20
Output
2

加入题单

算法标签: