CF1252I.Mission Possible

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Input begins with a line containing five integers: NN xLx_L yLy_L xRx_R yRy_R ( 0N500 \le N \le 50 ; 0xL<xR10000 \le x_L < x_R \le 1000 ; 0yL<yR10000 \le y_L < y_R \le 1000 ) representing the number of sensors and the secret base ( xLx_L , yLy_L , xRx_R , yRy_R ), respectively. The next line contains two integers: xsx_s ysy_s ( xL<xs<xRx_L < x_s < x_R ; yL<ys<yRy_L < y_s < y_R ) representing Allen's initial location. The next line contains two integers: xtx_t yty_t ( xL<xt<xRx_L < x_t < x_R ; yL<yt<yRy_L < y_t < y_R ) representing Allen's target location. It is guaranteed that xsxtx_s \ne x_t or ysyty_s \ne y_t . The next NN lines each contains three integers: xix_i yiy_i rir_i ( xL<xiri<xi+ri<xRx_L < x_i - r_i < x_i + r_i < x_R ; yL<yiri<yi+ri<yRy_L < y_i - r_i < y_i + r_i < y_R ; 1ri10001 \le r_i \le 1000 ) representing a sensor at location (xi,yi)(x_i, y_i) with an effective sensing radius of rir_i . It is guaranteed that the Euclidean distance of any two sensors ii and jj is larger than ri+rjr_i + r_j . It is also guaranteed that the Euclidean distance of (xs,ys)(x_s,y_s) and (xt,yt)(x_t,y_t) to any sensor ii is larger than rir_i .

输入格式

Output in a line an integer representing the size of a feasible PP . The next P|P| lines each contains two real numbers (separated by a single space); the jthj^{th} line contains xjx_j yjy_j representing the jthj^{th} point in PP . You may output any feasible PP with no more than 10001000 points.

Due to the nature of the output (floating point), let us define an epsilon ϵ\epsilon to be 10610^{-6} to verify the output. Consider Q1=(xs,ys)Q_1 = (x_s, y_s) , Qj+1=PjQ_{j+1} = P_j for all 1jP1 \le j \le |P| , and QP+2=(xt,yt)Q_{|P|+2} = (x_t, y_t) . Then, PP is considered correct if and only if PP contains no more than 10001000 points and all of the following are satisfied:

  • xLϵxpkxR+ϵx_L - \epsilon \le x_{p_k} \le x_R + \epsilon and yLϵypkyR+ϵy_L - \epsilon \le y_{p_k} \le y_R + \epsilon for all 1kP1 \le k \le |P| (Allen is not running out of the secret base).
  • For all 1k<Q1 \le k < |Q| , let SkS_k be the line segment connecting QkQ_k and Qk+1Q_{k+1} (Allen is running in straight line). For all 1iN1 \le i \le N , let (xk,i,yk,i)(x_{k,i},y_{k,i}) be the point along SkS_k that is the closest to the ithi^{th} sensor's location, (xi,yi)(x_i,y_i) . Let dk,id_{k,i} be the Euclidean distance between (xk,i,yk,i)(x_{k,i},y_{k,i}) and (xi,yi)(x_i,y_i) . Then, the constraint ridk,i+ϵr_i \le d_{k,i} + \epsilon should be satisfied (Allen is not detected by any sensor).
  • All points in QQ are distinct. Two points, (xa,ya)(x_a,y_a) and (xb,yb)(x_b,y_b) , are considered distinct if and only if xaxb>ϵ|x_a - x_b| > \epsilon or yayb>ϵ|y_a - y_b| > \epsilon .

输出格式

Explanation for the sample input/output #1

The figure above shows the PP from the sample output. Note that there exists a feasible PP with only one point in this sample, although you are not required to find such PP .

输入输出样例

  • 输入#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 PP from the sample output. Note that there exists a feasible PP with only one point in this sample, although you are not required to find such PP .

首页