Mail.Ru Cup 2018 Round 2 |
---|
Finished |
Bob has put on some weight recently. In order to lose weight a bit, Bob has decided to swim regularly in the pool. However, the day before he went to the pool for the first time he had a weird dream. In this dream Bob was swimming along one of the pool's lanes, but also there were some jellyfish swimming around him. It's worth mentioning that jellyfish have always been one of Bob's deepest childhood fears.
Let us assume the following physical model for Bob's dream.
Bob wants to swim the lane to its end and get stung the least possible number of times. He will start swimming on the line $$$y=-h$$$, and finish on the line $$$y=h$$$ where $$$h = 10^{10}$$$.
The first line contains two integers $$$n$$$ and $$$w$$$ ($$$3 \le n \le 200, 1 \le w \le 30000$$$) — the number of vertices in the polygon that constitutes the Bob's shape and the width of the swimming pool lane.
Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i \le w, 0 \le y_i \le 30000$$$) — the coordinates of corresponding vertex of the polygon. The vertices in the polygon are given in counterclockwise order. It is guaranteed that the given polygon is strictly convex.
The next line contains an only integer $$$m$$$ ($$$0 \le m \le 200$$$) — the number of the jellyfish in the pool.
Each of the next $$$m$$$ lines contains three integers ($$$x_i$$$, $$$y_i$$$, $$$r_i$$$ ($$$0 \le x_i \le w, 0 \le y_i \le 30000, 1 \le r_i \le 30000$$$) — coordinates of the $$$i$$$-th jellyfish in the pool and the radius of her activity. It is guaranteed, that no two jellyfish are located in the same point.
Output a single integer — the least possible number of jellyfish that will sting Bob.
4 4
0 0
2 0
2 2
0 2
3
1 1 1
3 5 1
1 9 1
0
4 6
0 0
3 0
3 3
0 3
3
1 0 1
4 2 2
3 6 1
2
4 2
0 0
1 0
1 1
0 1
2
1 1 1
1 3 1
2
Visualization of the possible solutions to the first and the second sample test cases are below:
Name |
---|