CF1252I.Mission Possible
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Input begins with a line containing five integers: N xL yL xR yR ( 0≤N≤50 ; 0≤xL<xR≤1000 ; 0≤yL<yR≤1000 ) representing the number of sensors and the secret base ( xL , yL , xR , yR ), respectively. The next line contains two integers: xs ys ( xL<xs<xR ; yL<ys<yR ) representing Allen's initial location. The next line contains two integers: xt yt ( xL<xt<xR ; yL<yt<yR ) representing Allen's target location. It is guaranteed that xs=xt or ys=yt . The next N lines each contains three integers: xi yi ri ( xL<xi−ri<xi+ri<xR ; yL<yi−ri<yi+ri<yR ; 1≤ri≤1000 ) representing a sensor at location (xi,yi) with an effective sensing radius of ri . It is guaranteed that the Euclidean distance of any two sensors i and j is larger than ri+rj . It is also guaranteed that the Euclidean distance of (xs,ys) and (xt,yt) to any sensor i is larger than ri .
输入格式
Output in a line an integer representing the size of a feasible P . The next ∣P∣ lines each contains two real numbers (separated by a single space); the jth line contains xj yj representing the jth point in P . You may output any feasible P with no more than 1000 points.
Due to the nature of the output (floating point), let us define an epsilon ϵ to be 10−6 to verify the output. Consider Q1=(xs,ys) , Qj+1=Pj for all 1≤j≤∣P∣ , and Q∣P∣+2=(xt,yt) . Then, P is considered correct if and only if P contains no more than 1000 points and all of the following are satisfied:
- xL−ϵ≤xpk≤xR+ϵ and yL−ϵ≤ypk≤yR+ϵ for all 1≤k≤∣P∣ (Allen is not running out of the secret base).
- For all 1≤k<∣Q∣ , let Sk be the line segment connecting Qk and Qk+1 (Allen is running in straight line). For all 1≤i≤N , let (xk,i,yk,i) be the point along Sk that is the closest to the ith sensor's location, (xi,yi) . Let dk,i be the Euclidean distance between (xk,i,yk,i) and (xi,yi) . Then, the constraint ri≤dk,i+ϵ should be satisfied (Allen is not detected by any sensor).
- All points in Q are distinct. Two points, (xa,ya) and (xb,yb) , are considered distinct if and only if ∣xa−xb∣>ϵ or ∣ya−yb∣>ϵ .
输出格式
Explanation for the sample input/output #1
The figure above shows the P from the sample output. Note that there exists a feasible P with only one point in this sample, although you are not required to find such P .
输入输出样例
输入#1
3 2 2 50 26 4 14 48 14 15 13 7 36 16 6 46 18 3
输出#1
2 13.25 23.1234567 36.591003 7.1
输入#2
1 0 0 1000 1000 100 501 900 501 500 251 250
输出#2
0
说明/提示
Explanation for the sample input/output #1
The figure above shows the P from the sample output. Note that there exists a feasible P with only one point in this sample, although you are not required to find such P .