시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 256 MB125423633.028%

문제

In an unprecedented turn of events, goblins recently launched an invasion against the Nedewsian city of Mlohkcots. Goblins—small, green critters—love nothing more than to introduce additional entropy into the calm and ordered lives of ordinary people. They fear little, but one of the few things they fear is water.

The goblin invasion has now reached the royal gardens, where the goblins are busy stealing fruit, going for joyrides on the lawnmower and carving the trees into obscene shapes, and King Lrac Fatsug has decreed that this nonsense stop immediately!

Thankfully, the garden is equipped with an automated sprinkler system. Enabling the sprinklers will soak all goblins within range, forcing them to run home and dry themselves.

Serving in the royal garden guards, you have been asked to calculate how many goblins will remain in the royal garden after the sprinklers have been turned on, so that the royal gardeners can plan their next move.

입력

The input starts with one integer 1 ≤ g ≤ 100 000, the number of goblins in the royal gardens.

Then, for each goblin follows the position of the goblin as two integers, 0 ≤ xi ≤ 10 000 and 0 ≤ yi ≤ 10 000. The garden is flat, square and all distances are in meters. Due to quantum interference, several goblins can occupy exactly the same spot in the garden.

Then follows one integer 1 ≤ m ≤ 20 000, the number of sprinklers in the garden.

Finally, for each sprinkler follows the location of the sprinkler as two integers 0 ≤ xi ≤ 10 000 and 0 ≤ yi ≤ 10 000, and the integer radius 1 ≤ r ≤ 100 of the area it covers, meaning that any goblin at a distance of at most r from the point (xi , yi) will be soaked by this sprinkler. There can be several sprinklers in the same location.

출력

Output the number of goblins remaining in the garden after the sprinklers have been turned on.

예제 입력 1

5
0 0
100 0
0 100
100 100
50 50
1
0 0 50

예제 출력 1

4

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2015 G번

  • 문제를 만든 사람: Lukáš Poláček, Pehr Söderman