CF1252I.Mission Possible
NOI/NOI+/CTSC
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Allen, a government secret service, has been assigned to infiltrate a mafia secret base to uncover crucial information regarding the mafia's operations.
The secret base is a rectangular bounded by (xL,yL), (xL,yR), (xR,yL), and (xR,yR) in a Cartesian coordinate system where xL<xR and yL<yR. There are N sensors placed inside the secret base. The ith sensor is located at (xi,yi) and has an effective sensing radius of ri which can detect any person who is strictly within the radius of ri from (xi,yi). In other words, the ith sensor can detect a person at location (xa,ya) if and only if the Euclidean distance of (xi,yi) and (xa,ya) is strictly less than ri. It is also known that the Euclidean distance of any two sensors i and j is strictly larger than ri+rj. Note that the Euclidean distance of two points, (xa,ya) and (xb,yb), is ∣xa−xb∣2+∣ya−yb∣2.
Allen begins his infiltration mission at location (xs,ys), and his target is located at (xt,yt). Allen has the power to run extremely fast in a straight line while he needs to spend extra time to change his running trajectory (to adjust his footing). Although he is a fast runner, he still needs to make sure that none of the sensors detect him while he is running, i.e. there is no point in his running trajectory which is strictly within a sensor effective sensing radius.
Let P=(xp1,yp1),…,(xp∣P∣,yp∣P∣) be the set of locations where Allen changes his running trajectory, thus, Allen's running trajectory with P is (xs,ys)→(xp1,yp1)→⋯→(xp∣P∣,yp∣P∣)→(xt,yt) where (xa,ya)→(xb,yb) implies that Allen is running from (xa,ya) to (xb,yb) in a straight line. The set P is feasible if and only if with P, Allen is not detected by any sensor and is not running out of the secret base (although, Allen is allowed to run along the secret base perimeter). Note that xp and yp, (xp,yp)∈P, are not necessarily integers; they can be real numbers.
Your task in this problem is to find any one feasible P which contains no more than 1000 points.
艾伦是一名政府秘密特工,被指派潜入一个黑手党秘密基地,以获取有关该黑手党组织运作的关键情报。
该秘密基地是一个矩形区域,其四个顶点在笛卡尔坐标系中分别为 (xL,yL)、(xL,yR)、(xR,yL) 和 (xR,yR),其中 xL<xR 且 yL<yR。基地内部共部署了 N 个传感器。第 i 个传感器位于 (xi,yi),其有效感知半径为 ri,可探测到严格位于以 (xi,yi) 为中心、半径为 ri 的开圆盘内的任何人。换言之,当且仅当点 (xi,yi) 与 (xa,ya) 之间的欧几里得距离严格小于 ri 时,第 i 个传感器才能探测到位于 (xa,ya) 处的人员。已知:任意两个传感器 i 与 j 之间的欧几里得距离严格大于 ri+rj。注意,两点 (xa,ya) 与 (xb,yb) 之间的欧几里得距离定义为 ∣xa−xb∣2+∣ya−yb∣2。
艾伦从起点 (xs,ys) 开始执行潜入任务,其目标位置为 (xt,yt)。他具备沿直线极速奔跑的能力,但每次改变运动轨迹(例如调整步伐)都需要额外耗时。尽管奔跑速度极快,他仍必须确保在整段行进过程中不被任何传感器探测到——即其运动轨迹上不存在任何一点严格处于任一传感器的有效感知半径之内。
令 P={(xp1,yp1),…,(xp∣P∣,yp∣P∣)} 表示艾伦改变运动轨迹的位置集合,则其完整运动路径为
(xs,ys)→(xp1,yp1)→⋯→(xp∣P∣,yp∣P∣)→(xt,yt),
其中符号 (xa,ya)→(xb,yb) 表示艾伦沿直线从 (xa,ya) 奔跑至 (xb,yb)。集合 P 是可行的,当且仅当:采用该路径时,艾伦既未被任何传感器探测到,也未跑出秘密基地边界(但允许沿基地周界边缘奔跑)。注意:对任意 (xp,yp)∈P,其坐标 xp 与 yp 不必为整数,可以是任意实数。
本题要求:找出任意一个可行的 P,且满足 ∣P∣≤1000。
输入格式
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.
输入的第一行包含五个整数:N xL yL xR yR(其中 0≤N≤50;0≤xL<xR≤1000;0≤yL<yR≤1000),分别表示传感器的数量以及秘密基地的边界坐标 (xL,yL,xR,yR)。
第二行包含两个整数:xs ys(满足 xL<xs<xR 且 yL<ys<yR),表示艾伦的初始位置。
第三行包含两个整数:xt yt(满足 xL<xt<xR 且 yL<yt<yR),表示艾伦的目标位置。
保证 xs=xt 或 ys=yt。
接下来的 N 行,每行包含三个整数:xi yi ri(满足 xL<xi−ri<xi+ri<xR;yL<yi−ri<yi+ri<yR;1≤ri≤1000),表示位于 (xi,yi) 处、有效感知半径为 ri 的一个传感器。
保证任意两个传感器 i 和 j 之间的欧几里得距离大于 ri+rj。
还保证初始点 (xs,ys) 和目标点 (xt,yt) 到任一传感器 i 的欧几里得距离均大于 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∣>ϵ.
在一行中输出一个整数,表示可行解 P 的大小(即点的数量)。接下来的 ∣P∣ 行每行包含两个实数(以单个空格分隔);第 j 行包含 xj 和 yj,表示 P 中的第 j 个点。你可以输出任意一个满足条件的 P,且其点数不超过 1000。
由于输出涉及浮点数,我们定义容差 ϵ=10−6 用于验证输出正确性。令 Q1=(xs,ys),对所有 1≤j≤∣P∣ 有 Qj+1=Pj,且 Q∣P∣+2=(xt,yt)。则 P 被视为正确当且仅当:P 所含点数不超过 1000,且以下所有条件均满足:
- 对所有 1≤k≤∣P∣,满足 xL−ϵ≤xpk≤xR+ϵ 且 yL−ϵ≤ypk≤yR+ϵ(Allen 未跑出秘密基地边界)。
- 对所有 1≤k<∣Q∣,令 Sk 为连接 Qk 与 Qk+1 的线段(Allen 沿直线奔跑)。对所有 1≤i≤N,令 (xk,i,yk,i) 为线段 Sk 上距离第 i 个传感器位置 (xi,yi) 最近的点;令 dk,i 为 (xk,i,yk,i) 与 (xi,yi) 之间的欧氏距离。则需满足约束 ri≤dk,i+ϵ(Allen 未被任何传感器探测到)。
- Q 中所有点互异。两点 (xa,ya) 与 (xb,yb) 被视为互异当且仅当 ∣xa−xb∣>ϵ 或 ∣ya−yb∣>ϵ。
输入输出样例
输入#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.
样例输入/输出 #1 的说明

上图展示了样例输出中的集合 P。注意:在该样例中,存在一个仅含一个点的可行集合 P,但你无需找出这样的 P。
输入解题思路,AI测评打分。不知道怎么写?