시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 0 0 0 0.000%

문제

You are given the vertices of a simple, convex polygon. “Simple” means that there are no crossing or overlapping edges. “Convex” means that, as you walk around the polygon, you keep moving consistently clockwise (or counterclockwise) relative to any point strictly inside the polygon. You are also given a set of points. Your task is to find the number of those points that are enclosed by the polygon. Points are “enclosed” if they are inside the polygon, or lie on an edge, or are coincident with a polygon vertex. All points and polygon vertices lie on an integer grid, with absolute coordinate values being less than 1000.

입력

There will be one or more data sets in the input file. Each data set contains:

  • First line: the number of vertices (n, with 3 ≤ n ≤ 100), and the number of points (m, with 1 ≤ m ≤ 100)
  • Next n lines: x- and y-coordinates of polygon vertices in either clockwise or counterclockwise order.
  • Next m lines: x- and y-coordinates of points.

The last data set contains 0 0 for the first line, and is not to be processed.

출력

For each data set, print the number of the set, where the first set is set 1, and the number of points enclosed.

예제 입력 1

4 6
0 0
2 2
5 5
5 –1
5 3
7 3
5 –1
5 –2
2 2
4 1
3 1
0 0
5 0
5 5
0 5
0 0

예제 출력 1

Data set 1: 4
Data set 2: 0