F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Bomb

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7987    Accepted Submission(s): 2313


Problem Description
There are $N$ bombs needing exploding.

Each bomb has three attributes: exploding radius $r_i$, position $(x_i,y_i)$ and lighting-cost $c_i$ which means you need to pay $c_i$ cost making it explode.

If a un-lighting bomb is in or on the border the exploding area of another exploding one, the un-lighting bomb also will explode.

Now you know the attributes of all bombs, please use the minimum cost to explode all bombs.
 

Input
First line contains an integer $T$, which indicates the number of test cases.

Every test case begins with an integers $N$, which indicates the numbers of bombs.

In the following $N$ lines, the ith line contains four intergers $x_i$, $y_i$, $r_i$ and $c_i$, indicating the coordinate of ith bomb is $(x_i, y_i)$, exploding radius is $r_i$ and lighting-cost is $c_i$.

Limits
- $1 \leq T \leq 20$
- $1 \leq N \leq 1000$
- $-10^8 \leq x_i, y_i, r_i \leq 10^8$
- $1 \leq c_i \leq 10^4$
 

Output
For every test case, you should output 'Case #x: y', where x indicates the case number and counts from 1 and y is the minimum cost.
 

Sample Input
1 5 0 0 1 5 1 1 1 6 0 1 1 7 3 0 2 10 5 0 1 4
 

Sample Output
Case #1: 15
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-29 04:04:19, Gzip enabled