|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||2||0||0||0.000%|
There are N items numbered from 1 to N to be sold at an auction market on a particular day, and the ith item has a starting price of Si. There are M potential buyers numbered from 1 to M who want to participate in the auction, and the jth potential buyer has a budget of Bj.
Each potential buyer, one by one from the 1st to the Mth potential buyer consecutively, inspects each item, one by one from the 1st to the Nth item consecutively, and decides whether he is able to bid on that item. The jth potential buyer is able to bid on the ith item if and only if at least one of the following conditions is satisfied.
If the jth potential buyer is able to bid on the ith item, then he will bid that ith item at Bj and stop inspecting the remaining items, i.e. he will ignore the (i + 1)th to Nth items. With this behavior, each potential buyer will only bid at most 1 item. Note that it is also possible for a potential buyer to fail to bid on any item at all, i.e. when his budget is too low.
At the end of the day, after all the potential buyers have either placed their bid or inspected all items, the highest bid for each item is determined and the items are sold to the respective highest bidder. Items that do not have any bidder are not sold.
Your task is to find out how many items are successfully sold at the end of the day.
Input begins with a line containing an integer: N (1 ≤ N ≤ 100 000) representing the number of items to be sold at the auction market. The second line contains N integers: Si (1 ≤ Si ≤ 109) representing the starting price of each item. The third line contains an integer M (1 ≤ M ≤ 100 000) representing the number of potential buyers. The fourth line contains M integers: Bj (1 ≤ Bj ≤ 109) representing the budget of each potential buyer.
Output in a line an integer representing the number of items that are successfully sold at the end of the day.
3 100 200 150 5 110 250 220 130 140
At the end of the day,
Therefore, two items are sucessfully sold.
4 1000 1000 1000 1000 4 3000 2000 2500 1000
5 10 40 30 50 20 4 5 50 10 15