Ice Cream Shop
시간 제한2초메모리 제한2048 MB
기존 아이스크림 가게들이 늘어선 직선 위에 새 가게 하나를 놓아, 자기 집에서 가장 가까운 가게가 새 가게가 되는 사람 수를 최대로 만든다.
문제
On a beach there are huts in a perfect line, hut being at the left and hut being meters to the right of hut , for all . In hut there are people.
There are ice cream sellers, also aligned in a perfect line with all the huts. The -th ice cream seller has their shop meters to the right of the first hut. All ice cream shops are at distinct locations, but they may be at the same location as a hut.
You want to open a new ice cream shop and you wonder what the best location for your shop is. You can place your ice cream shop anywhere on the beach (not necessarily at an integer distance from the first hut) as long as it is aligned with the huts and the other ice cream shops, even if there is already another ice cream shop or a hut at that location. You know that people would come to your shop only if it is strictly closer to their hut than any other ice cream shop.
If every person living in the huts wants to buy exactly one ice cream, what is the maximum number of ice creams that you can sell if you place the shop optimally?
입력
The first line contains two integers and (, ) — the number of huts and the number of ice cream sellers.
The second line contains integers , , , () — the number of people in each hut.
The third line contains integers , , , (, for ) — the location of each ice cream shop.
출력
Print the maximum number of ice creams that can be sold by choosing optimally the location of the new shop.