|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||12||5||4||36.364%|
A fleet of fishing boats set sail on the open sea from an Adriatic island. The position of each fishing boat is described with a point in the standard coordinate system, whereas the island is described with a convex polygon. The boats communicate via radio devices, and the island represents an obstacle for the radio waves. More precisely, if boat a transmits a message, then boat b receives the message if and only if the line segment connecting the positions of a and b does not cross the interior of the island (it is allowed to have the line segment touch the sides and vertices of the island).
Figure 3: In the first sample test, ships 2, 3, 4 and 7 will receive the original Mayday message, whereas ships 6 and 8 will receive the Relay message.
When ship a gets in trouble, it transmits the so-called Mayday message asking for help. All ships that receive the Mayday message immediately send the so-called Relay message repeating that ship a needs help. If a ship only receives the Relay message (and not the original Mayday message), then it sends nothing.
You are given the positions of n ships denoted with integers from 1 to n and the location of the island. Ship number 1 has found itself in trouble and sends the Mayday message. Determine the total number of ships that will receive either the original Mayday message or any of the Relay messages.
The first line of input contains the integer n (1 ≤ n ≤ 100 000) – the number of ships. The kth of the following n lines contains two integers xk and yk (−109 ≤ xk, yk ≤ 109) – the coordinates of the kth ship. All ships are located on different coordinates, not a single ship is located on a side or inside the polygon.
The following line contains the integer m (3 ≤ m ≤ 100 000)– the number of vertices of the convex polygon describing the island. The kth of the following m lines contains two integers x'k and y'k (−109 ≤ x'k, y'k ≤ 109) – the coordinates of the kth vertex of the polygon. The polygon’s vertices are given in the counter-clockwise direction and form a convex polygon. No two adjacent edges will be parallel.
You must output the required total number of boats that will receive one of the messages.
9 9 6 8 5 10 8 8 8 -2 3 -1 5 9 1 0 1 -1 2 7 1 1 5 1 8 3 7 5 4 6 0 5 -1 3
4 -1 0 -3 -20 6 10 5 10 4 3 0 3 1 0 10 0 -10