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 the Bridge

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 303    Accepted Submission(s): 66


Problem Description
You want to destroy a bridge with bombs .The lower-left corner of the bridge is at (0,0) and upper-right corner is at ( w , l ). There are already b bombs exploded , the i-th bombcreated a hole of radius ri centering at (xi , yi) .You want to throw exactly one more bomb so that the bridge is split into two connected parts( though the two parts can share a finite number of points),so that no one can go through the bridge from y=0 to y=l .You task is to find the minimal radius of the last bomb to split the bridge , assuming that the last bomb can explode precisely at the position you want (possibly at non-integer
coordinates).Note that you are only allowed to use bombs with integer radius .That is ,even if a bomb with radius 1.01 is sufficient , you have to use a bomb with radius 2, since you only have bombs with integer radius.
 

Input
The first line contains t (1<= t <=10), the number of test cases followed . Each test case begins with three integers w , l, b (1<= w , l<=100 , 0<= b <= 10). Each of the following b lines contains three integers integers xi, yi , ri (0<= x <=w, 0<= y <=l, 0< r <=100). The bridge is guaranteed to be connected before the last bomb.
 

Output
For each test case , print the minimal radius of the last bomb.
 

Sample Input
3 100 100 2 15 50 20 90 50 30 100 100 1 50 50 40 100 100 1 10 50 10
 

Sample Output
13 50 40
 

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-11-22 19:48:18, Gzip enabled