Anti-Missile

시간 제한1초메모리 제한2048 MB

요약
미사일 m발과 자원 점들, 반경을 가진 방어 시스템이 주어질 때 파괴할 수 있는 자원의 최대 개수를 구한다. 각 점은 많아야 하나의 방어 시스템이 보호한다.
난이도

보통10점 중 7점

유형
그래프, DFS, 그리디, 트리
정답자
아직 제출이 없습니다

문제

We want to execute a strategic missile strike against an enemy’s critical resources. The enemy has deployed air defence systems to protect these resources. However, their defence setup has certain vulnerabilities, and your mission is to exploit them effectively.

Each air defence system can protect all strategic resources and air defence systems within its radius of operation, but cannot defend itself. Due to technical limitations, each critical resource or air defence system is protected by at most one other air defence system.

Missiles can be used to destroy either an undefended strategic resource or an air defence system.

A resource is considered undefended if no active air defence system protects it. When an air defence system is destroyed, it can no longer protect any resources or other air defence systems. Your goal is to maximize the number of strategic resources destroyed.

입력

The input consists of the following:

The first line contains three integers mm (number of missiles), nn (number of strategic resources), and dd (number of air defence systems), where (0≤m,n,d≤5,0000 \le m, n, d \le 5\\, 000).

The next nn lines contain two integers x_ix\_i and y_iy\_i (0≤x_i,y_i≤1090 \le x\_i , y\_i \le 10^9) the coordinates of the iith strategic resource.

The following dd lines each contain three integers x_jx\_j, y_jy\_j and r_jr\_j (0≤x_j,y_j≤1090 \le x\_j , y\_j \le 10^9; 0≤r_j≤1090 \le r\_j \le 10^9) the coordinates of the jjth air defence system and its radius of protection.

출력

Output the maximum number of strategic resources that can be destroyed.

힌트

The example test case is depicted by the figure below:

예제1

  1. 예제 1

    입력
    3 4 3
    0 0
    10 20
    20 20
    30 30
    5 5 9
    16 16 14
    25 25 5
    
    예상 출력
    2