#P4023. Counting Extreme Points in a Planar Set
Counting Extreme Points in a Planar Set
Counting Extreme Points in a Planar Set
Given a finite set of points P on the plane and another set of points A, we define the function \[ f(p,S)= \begin{cases}1,&\text{if }p\text{ lies in the convex hull of }S\ (\text{including its boundary}),\\0,&\text{otherwise}. \end{cases} \] For each point \(a_i\) in A, we call it an extreme point if and only if \[ \sum_{\substack{j=1\\j\ne i}}^{M} f(a_i,P\cup\{a_j\})=0, \] that is, for every other point \(a_j\) (with \(j\ne i\)) in A, the point \(a_i\) does not lie in the convex hull of \(P\cup\{a_j\}\). Your task is to count the number of extreme points in A.
Note: A point lying on the boundary of a convex hull is considered to be inside the convex hull.
inputFormat
The first line contains two integers \(N\) and \(M\) representing the number of points in set P and set A respectively. The next \(N\) lines each contain two integers \(x\) and \(y\) representing the coordinates of a point in P. The following \(M\) lines each contain two integers representing the coordinates of a point in A.
It is guaranteed that all coordinates are integers.
outputFormat
Output a single integer, which is the count of extreme points in set A.
sample
0 1
0 0
1