| Yangyang loves AC |
|Time Limit: 2000ms, Special Time Limit:5000ms, Memory Limit:65536KB |
| Total submit users: 32, Accepted users: 14 |
| Problem 11560 :
No special judgement
| Yangyang takes part in the ACM Summer Training. She loves AC, but there is so much knowledge to learn, For example, Dynamic Programming, Greedy, Search, Graph, Data Structure, and so on. So she decides to ask some other ACMers for help. There are some details below:|
There are M (1 <= M <= 20000) ACMers. As we know, ACMers are always busy, so she decides to ask each ACMer at most once.
After being helped, Yangyang will fell happy, The i-th ACMer will bring her Hi(1 <= Hi <= 2^13)Happiness. Moreover, Yangyang prefer to numbers that are power of 2, (that is to say, only 1, 2, 4, 8, 16 … 2^13 are valid value of the happiness)
Summer Training has N (1 <= N <= 20000) days. Yangyang have a threshold of happiness Ti (1 <= Ti <= 20000) at the i-th day. If the total happiness of the day is greater than or equal to Ti, this day will be a happy day for her. Yangyang wants to maximize the number of happy days, but she doesn’t know how to achieve the idea, so again she come to ask you for help, can you make her happy?
| There are multiple test cases. |
In each test case, the first line contains two postive integers N,M, separated by a space, where N indicates the number of days, and M indicates the number of ACMers
The following N lines, each will contain a integer, the i-th integer indicates the threshold of happiness for the i-th day.
The following M lines, each will contain a integer, the i-th integer indicates the happiness which the i-th ACMer will bring to her.
| For each test case ,output an integer, the maximum number of happy days.|