P28664 [洛谷] [CQOI2017] Xiao Q's Draft Paper
省选
题目描述

Problem Description

Q is a programmer.

As is well known, programmers often need draft paper when writing code. Xiao Q now needs a draft paper to draw diagrams, but there is only one draft paper on the desk, and it has been used many times before.

The draft paper can be considered as a two-dimensional plane, and Xiao Q has even established a Cartesian coordinate system for it. Each previously used area can be approximately regarded as a triangle on this plane, and both the interior and the boundary of this triangle cannot be used again. Of course, there have been no overlapping areas from previous drafts.

Xiao Q has already marked some key points on the draft paper, all of which are in unused areas. Xiao Q wants to connect these key points pairwise with line segments as much as possible. However, the line segment connecting two key points might cross the previously used areas, which is obviously not allowed. Therefore, Xiao Q wants to know how many pairs of key points can be connected with a line segment without crossing the previously used areas. For convenience, Xiao Q guarantees that no three key points are collinear.

Input Format

The first line contains two integers V and T, representing the number of key points and the number of triangular areas on the draft paper, respectively.

The next V lines, each containing two integers x and y, represent the coordinates (x, y) of a key point.

The next T lines, each containing six integers $x_1, y_1, x_2, y_2, x_3, y_3$, represent the coordinates of the three vertices of a triangular area: $(x_1, y_1), (x_2, y_2), (x_3, y_3)$, ensuring that the area of the triangle is greater than 0.

Output Format

Output a single line containing an integer, representing the number of pairs of key points that can be connected with a line segment without crossing the previously used areas.

Sample Input and Output

Sample Input #1

3 0
0 0
2 0
2 2

Sample Output #1

3

Sample Input #2

3 1
0 0
2 0
2 2
1 0 1 1 2 1

Sample Output #2

0

Notes

Sample 1 Explanation:

The entire draft paper is new, so any two key points can be connected.

Sample 2 Explanation:

As shown in the figure, any line connecting two key points is blocked.

Image

Data Range and Constraints:

For 100% of the test cases, 0 ≤ all coordinates ≤ $10^8$, and all coordinates are integers.

NO 1  2  3   4   5   6   7    8    9   10
V 10 20 50 100 200 400 600 1000 1000 1000
T 10 20 50 100 200 400 600 1000 1000 1000
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 0 0 0 2 0 2 2
样例输出
3