HRY and cats
题号:NC25453
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Cats are so cute! They are so cute that HRY wants to catch some and bring them home to make some soup.
There are n cats in the yard, lying on the ground and sunbathing. HRY wants to make a fence to keep all the cats inside. HRY looked around and found that there are m stumps to make fence. Now he is going to make fence in the following way: he will first choose k stumps p_1, p_2,...,p_k, and connect p_1 and p_2, p_2 and p_3, ..., and p_n, p_n and p_1, and form a simple polygon. HRY want all cats strictly inside this polygon, which means no cat should be on the edge or point of the polygon. HRY now wonders how many stumps at least can he use to keep the cats inside?

输入描述:

The first line contains an integer T, indicating the number of test cases.
For each test case :
The first line contains two integer n,m, indicating the number of cats and the number of stumps.
The next n lines each contains two integers x, y, indicating the coordinates of each cat.
The next m lines each contains two integers x, y, indicating the coordinates of each stump.
.

输出描述:

For each test case, output a line of one integer, indicating the number of stumps HRY can use at least to catch all cats. If HRY can not catch all cats, just output -1.
示例1

输入

复制
1
4 4
1 1
1 2
2 1
2 2
0 0
0 3
3 3
3 0

输出

复制
4