CF1359F.RC Kaboom Show

省选/NOI-

通过率:0%

时间限制:6.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

You know, it's hard to conduct a show with lots of participants and spectators at the same place nowadays. Still, you are not giving up on your dream to make a car crash showcase! You decided to replace the real cars with remote controlled ones, call the event "Remote Control Kaboom Show" and stream everything online.

For the preparation you arranged an arena — an infinite 2D-field. You also bought nn remote controlled cars and set them up on the arena. Unfortunately, the cars you bought can only go forward without turning left, right or around. So you additionally put the cars in the direction you want them to go.

To be formal, for each car ii (1≤i≤n1 \le i \le n) you chose its initial position (xi,yix_i, y_i) and a direction vector (dxi,dyidx_i, dy_i). Moreover, each car has a constant speed sis_i units per second. So after car ii is launched, it stars moving from (xi,yix_i, y_i) in the direction (dxi,dyidx_i, dy_i) with constant speed sis_i.

The goal of the show is to create a car collision as fast as possible! You noted that launching every car at the beginning of the show often fails to produce any collisions at all. Thus, you plan to launch the ii-th car at some moment tit_i. You haven't chosen tit_i, that's yet to be decided. Note that it's not necessary for tit_i to be integer and tit_i is allowed to be equal to tjt_j for any i,ji, j.

The show starts at time 00. The show ends when two cars ii and jj (i≠ji \ne j) collide (i. e. come to the same coordinate at the same time). The duration of the show is the time between the start and the end.

What's the fastest crash you can arrange by choosing all tit_i? If it's possible to arrange a crash then print the shortest possible duration of the show. Otherwise, report that it's impossible.

你知道,如今要在同一地点举办一场拥有大量参与者和观众的演出是非常困难的。尽管如此,你仍未放弃实现“汽车碰撞秀”的梦想!你决定用遥控车替代真实汽车,将这场活动命名为“遥控爆炸秀”,并全程在线直播。

为筹备演出,你布置了一个场地——一个无限大的二维平面。你还购买了 nn 辆遥控车,并将它们部署在该场地上。不幸的是,你所购得的遥控车只能沿直线向前行驶,无法向左、向右或掉头转向。因此,你额外为每辆车设定了其初始朝向。

形式化地讲,对每辆编号为 ii(1≤i≤n1 \le i \le n)的车,你选定其初始位置 (xi,yi)(x_i, y_i) 和方向向量 (dxi,dyi)(dx_i, dy_i)。此外,每辆车具有恒定速度 sis_i(单位:每秒长度单位)。因此,当第 ii 辆车启动后,它将从位置 (xi,yi)(x_i, y_i) 出发,沿方向 (dxi,dyi)(dx_i, dy_i) 以恒定速度 sis_i 运动。

本演出的目标是尽快制造一次汽车碰撞!你注意到:若所有车辆都在演出开始时刻同时启动,往往根本不会发生任何碰撞。因此,你计划在某个特定时刻 tit_i 启动第 ii 辆车。目前 tit_i 尚未确定,有待你选择。注意:tit_i 不必为整数,且对任意 i,ji,j,允许 ti=tjt_i = t_j。

演出于时刻 00 开始。当两辆编号不同(即 i≠ji \ne j)的车 ii 和 jj 发生碰撞(即在同一时刻到达同一坐标点)时,演出结束。演出持续时间即为从开始到结束的时间间隔。

通过合理选择所有 tit_i,你能实现的最快碰撞是什么?若可安排出碰撞,请输出最短可能的演出持续时间;否则,请报告这是不可能的。

输入格式

The first line contains a single integer nn (1≤n≤250001 \le n \le 25000) — the number of cars.

Each of the next nn lines contains five integers xix_i, yiy_i, dxidx_i, dyidy_i, sis_i (−103≤xi,yi≤103-10^3 \le x_i, y_i \le 10^3; 1≤∣dxi∣≤1031 \le |dx_i| \le 10^3; 1≤∣dyi∣≤1031 \le |dy_i| \le 10^3; 1≤si≤1031 \le s_i \le 10^3) — the initial position of the ii-th car, its direction vector and its speed, respectively.

It's guaranteed that all cars start at distinct positions (i. e. (xi,yi)≠(xj,yj)(x_i, y_i) \neq (x_j, y_j) for i≠ji \neq j).

第一行包含一个整数 nn(1≤n≤250001 \le n \le 25000)——汽车的数量。

接下来的 nn 行中,每行包含五个整数 xix_i、yiy_i、dxidx_i、dyidy_i、sis_i(−103≤xi,yi≤103-10^3 \le x_i, y_i \le 10^3;1≤∣dxi∣≤1031 \le |dx_i| \le 10^3;1≤∣dyi∣≤1031 \le |dy_i| \le 10^3;1≤si≤1031 \le s_i \le 10^3),分别表示第 ii 辆车的初始位置、方向向量及其速度。

保证所有汽车的起始位置互不相同(即对任意 i≠ji \neq j,有 (xi,yi)≠(xj,yj)(x_i, y_i) \neq (x_j, y_j))。

输出格式

Print the shortest possible duration of the show if it's possible to arrange a crash by choosing all tit_i. Otherwise, print "No show :(".

Your answer is considered correct if its absolute or relative error does not exceed 10−610^{-6}.

Formally, let your answer be aa, and the jury's answer be bb. Your answer is accepted if and only if ∣a−b∣max⁡(1,∣b∣)≤10−6\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}.

如果可以通过选择所有 tit_i 来安排一次碰撞,则输出该演出可能的最短持续时间;否则输出 "No show :("。

若你的答案绝对误差或相对误差不超过 10−610^{-6},则视为正确。

形式化地,设你的答案为 aa,评测机的答案为 bb。当且仅当 ∣a−b∣max⁡(1,∣b∣)≤10−6\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6} 时,你的答案被接受。

输入输出样例

  • 输入#1

    4
    3 -1 -1 1 2
    2 3 -3 -2 10
    -4 2 1 -2 1
    -2 -2 -1 2 4

    输出#1

    0.585902082262898
  • 输入#2

    2
    -1 1 -1 1 200
    1 1 1 5 200

    输出#2

    No show :(

说明/提示

Here is the picture for the first example:

The fastest cars to crash are cars 22 and 44. Let's launch car 22 at 00, car 44 at about 0.0967620.096762 and cars 11 and 33 at arbitrary time. That way cars 22 and 44 will crash into each other at about 0.5859020.585902. So here's what it looks like at the moment of the collision:

Here's the picture for the second example:

第一个示例的示意图如下:

碰撞速度最快的两辆车是第 22 号车和第 44 号车。我们可将第 22 号车在时刻 00 发射,第 44 号车在约 0.0967620.096762 时刻发射,而第 11 号车和第 33 号车则在任意时刻发射。如此一来,第 22 号车与第 44 号车将在约 0.5859020.585902 时刻发生碰撞。下图即为碰撞发生瞬间的情形:

第二个示例的示意图如下:

输入解题思路,AI测评打分。不知道怎么写?

首页