P17390 [CodeChef] REDBLUE
提高+
题目描述

Read problems statements in Mandarin chinese, Russian and Vietnamese as well.

You are given N red points and M blue points on a 2D plane.

You are required to delete the minimum number of points(the deleted points can be of both colors) so that it's possible to draw a line such that all remaining red points are on one side of the line while all remaining blue points are on the other side of the line.

------ Input ------

The first line of the input contains an integer T denoting the number of test cases.

The first line of each test case contains two space-separated integers N and M.

Each of the next N lines contains two integers Xr_{i}, Yr_{i} describing the coordinates of the i-th red point.

Each of the next M lines contains two integers Xb_{i}, Yb_{i} describing the coordinates of the i-th blue point.

------ Output ------

For each test case, output a single line containing one integer denoting the minimum number of points to be deleted.

------ Constraints ------

$1 ≤ T ≤ 100$
$1 ≤ N, M ≤ 1,000$
$1 ≤ sum of N in all test cases ≤ 1,000$
$1 ≤ sum of M in all test cases ≤ 1,000$
$-10^{9} ≤ Xr_{i}, Yr_{i}, Xb_{i}, Yb_{i} ≤ 10^{9}$
$No two points among both red and blue points have same coordinates$
$No three points among both red and blue points are collinear$

------ Subtasks ------

Subtask #1 (20 points): 1 ≤ sum of N in all test-cases, sum of M in all test-cases ≤ 100

Subtask #2 (80 points): original constraints

----- Sample Input 1 ------
1
4 4
0 0
10 10
0 10
10 0
12 11
2 1
12 1
2 11
----- Sample Output 1 ------
2

输入格式

见题面

输出格式

见题面

样例输入
1 4 4 0 0 10 10 0 10 10 0 12 11 2 1 12 1 2 11
样例输出
2