410786: GYM104114 B Birthday Cake

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

Description

B. Birthday Caketime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

How exciting! Today is your little brother's birthday! That's why you ordered a huge ($$$1 \times 1$$$)-meter cake. It is a special vanilla cake with $$$n$$$ sweet chocolate chips and $$$m$$$ refreshing strawberries.

You show him your awesome surprise, and... bummer! It turns out that he hates fruit! "Of course, how could I have forgotten?" you say. Nonetheless, he has a sweet tooth for chocolate, so he would be happy if you could cut him a piece of the cake that contains no strawberries. To make him happy, you'd want to give him a piece having as many chocolate chips as possible.

The picture above depicts the example test case.

You can only make one cut along a straight line through the cake, and you are not allowed to cut though either chocolate chips or strawberries. What is the maximum number of chocolate chips that you may give your little brother?

Note: The picture above is for illustration purposes. You should consider both chocolate chips and strawberries to be infinitesimally small.

Input

The first line of the input contains two positive integers $$$n$$$ ($$$1 \leq n \leq 50\:000$$$) and $$$m$$$ ($$$1 \leq m \leq 100$$$)  — the number of chocolate chips and strawberries, respectively.

The $$$i$$$-th of the next $$$n + m$$$ lines contains two decimal numbers $$$x_i$$$ and $$$y_i$$$, ($$$0 < x_i, y_i < 1$$$), representing the coordinates of the $$$i$$$-th ingredient: the first $$$n$$$ of the ingredients are chocolate chips, and the remaining $$$m$$$ are strawberries.

All numbers are given with at most $$$6$$$ decimal places. The locations of all $$$n+m$$$ ingredients are distinct.

Output

Output a single non-negative integer $$$c$$$, representing the maximum number of chocolate chips that you can give your little brother after cutting the cake exactly once.

ExampleInput
5 2
0.2 0.6
0.8 0.6
0.6 0.2
0.1 0.2
0.6 0.8
0.6 0.6
0.5 0.5
Output
3

加入题单

算法标签: