Gift Wrapping

Xem dạng PDF

Gửi bài giải

Điểm: 1,50 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Ha Minh Ngoc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

On Christmas, Beo will wrap gifts beautifully for the children. Beo buys n cube gifts, the ~i-th~ gift is the size of ~a_i~ (1in ) and m sheets of wrapping paper where the ~j-th~ sheet is the size of ~b_j~ (1jm ). Know that wrapping paper needs to be 2 to 3 times larger than the gift.

Ask that with the number of gifts and wrapping paper given, what is the maximum number of gifts that Beo can wrap.

Input

  • The first line consists of 2 integers n, m () – the number of gifts and the number of gift wrapping paper.

  • The second line contains n integers ~a_i~ (1 ≤ ~i~ ≤ n ) – the size of gifts.

  • The third line contains m integers ~b_i~ (1 ≤ ~j~ ≤ m) – the size of the wrapping papers

Output

  • The maximum number of gifts that Beo can wrap

Sample Input:

4 4
2 3 2 4
5 10 15 20

Sample Output:

2

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.