#C8017. Checkpoint Safety Zone Validation
Checkpoint Safety Zone Validation
Checkpoint Safety Zone Validation
In this problem, you are given a set of checkpoints and safe zones on the 2D plane. Each safe zone is a circle defined by its center and radius. A checkpoint is considered to be within a safe zone if it lies inside or on the boundary of the circle. Formally, a point ((x, y)) is inside a safe zone centered at ((a, b)) with radius (r) if [ \sqrt{(x - a)^2 + (y - b)^2} \le r ] You are required to determine, for each test case, whether every checkpoint falls within at least one of the safe zones. If every checkpoint is covered, output "VALID"; otherwise, output "INVALID".
The input consists of multiple test cases. Each test case begins with a line containing two integers (C) and (S), representing the number of checkpoints and the number of safe zones respectively. The next (C) lines each contain two integers representing the (x) and (y) coordinates of a checkpoint. Following that, the next (S) lines each contain three integers representing the (x) and (y) coordinates of the center of a safe zone and its radius. A single line containing "0" terminates the input.
inputFormat
The input is read from standard input (stdin) and consists of multiple test cases. Each test case is described as follows:
- The first line contains two space-separated integers (C) and (S), where (C) is the number of checkpoints and (S) is the number of safe zones.
- The next (C) lines each contain two space-separated integers representing the coordinates of a checkpoint.
- The following (S) lines each contain three space-separated integers representing the center coordinates and the radius of a safe zone.
- The list of test cases is terminated by a line containing a single zero ("0").
outputFormat
For each test case, output a single line to standard output (stdout) containing either "VALID" if every checkpoint is within at least one safe zone, or "INVALID" otherwise.## sample
3 2
1 2
3 4
5 6
2 2 3
6 6 2
0
VALID
</p>