题号:NC224728
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld
题目描述
You are planning to travel in interstellar space in hope of finding habitable planets. You have already
identified 𝒏 stars that can recharge your spaceship via its solar panels. The only work left is to decide the
orientation of the spaceship that maximizes the distance it can travel.
Space is modeled as a 2D plane, with the Earth at the origin. The spaceship can be launched from the
Earth in a straight line, in any direction. A star can provide enough energy to travel a certain distance if
the spaceship is launched at a certain angle with the 𝑋-axis. If the angle is not perfectly aligned, then the
spaceship gets less energy.
Each star has a distance 𝒕 that the spaceship can travel if launched at an angle 𝒂 with the 𝑋-axis, and a
multiplier 𝒔 which indicates the decay of distance as angles diverge from 𝒂. if the launch direction makes
an angle of 𝒃 with the 𝑋-axis, then the spaceship gets enough energy to travel a distance of:
𝐦𝐚𝐱 (0, 𝒕 − 𝒔 ∙ 𝑑𝑖𝑠𝑡[𝒂, 𝒃])
where 𝑑𝑖𝑠𝑡[𝒂, 𝒃] is the minimum non-negative radians needed to go between angles 𝒂 and 𝒃. The total
distance that the spaceship can travel is simply the sum of the distances that each star contributes.
Find the maximum distance that the starship can travel.
输入描述:
The first line of input contains a single integer 𝒏 (1 ≤ 𝒏 ≤ 105), which is the number of stars.
输出描述:
Output the desired permutation on a single line as a sequence of 𝒏 space-separated integers, or output -1 if no such permutation exists.
Each of the next 𝒏 lines contains three space-separated real numbers 𝒕 (0.0 < 𝒕 ≤ 1000.0) 𝒔 (0.0 ≤ 𝒔 ≤ 100.0) 𝒂 (0.0 ≤ 𝒂 < 2𝜋)
where 𝒕 is the greatest distance that star’s energy can support, 𝒔 is that star’s decay multiplier, and 𝒂 is the best angle for achieving the greatest distance from energy from that star.
示例2
输入
复制
4
100 1 0.5
200 1 1
100 0.5 1.5
10 2 3
备注:
Output a single real number, which is the maximum distance that the spacecraft can travel. Your answer must be accurate to within 10-6 absolute or relative error.