CF385D.Bear and Floodlight

提高+/省选-

通过率:0%

时间限制:4.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

One day a bear lived on the Oxy axis. He was afraid of the dark, so he couldn't move at night along the plane points that aren't lit. One day the bear wanted to have a night walk from his house at point (l, 0) to his friend's house at point (r, 0), along the segment of length (r - l). Of course, if he wants to make this walk, he needs each point of the segment to be lit. That's why the bear called his friend (and yes, in the middle of the night) asking for a very delicate favor.

The Oxy axis contains n floodlights. Floodlight i is at point (x__i, y__i) and can light any angle of the plane as large as a__i degree with vertex at point (x__i, y__i). The bear asked his friend to turn the floodlights so that he (the bear) could go as far away from his house as possible during the walking along the segment. His kind friend agreed to fulfill his request. And while he is at it, the bear wonders: what is the furthest he can go away from his house? Hep him and find this distance.

Consider that the plane has no obstacles and no other light sources besides the floodlights. The bear's friend cannot turn the floodlights during the bear's walk. Assume that after all the floodlights are turned in the correct direction, the bear goes for a walk and his friend goes to bed.

一天,一只熊住在 Oxy 坐标轴上。他害怕黑暗,因此无法在夜间沿平面上未被照亮的点移动。某天夜里,这只熊想从自己位于点 (l, 0) 的家出发,沿着线段走到位于点 (r, 0) 的朋友家,该线段长度为 (r − l)。显然,若他想完成这次夜行,线段上的每一点都必须被照亮。因此,这只熊给他的朋友打了个电话(没错,是在深夜),请求一个非常精细的帮助。

Oxy 坐标轴上有 n 盏探照灯。第 i 盏探照灯位于点 (x__i, y__i),其照明范围是以 (x__i, y__i) 为顶点、张角大小为 a__i 度的任意平面角。熊请朋友将这些探照灯调整至合适的方向,使得他在沿该线段行走时,能尽可能远离自己的家。这位善良的朋友欣然答应了这一请求。而就在朋友调整探照灯的同时,熊不禁思考:他最多能离自己的家多远?请帮助他求出这个最大距离。

假设平面内无障碍物,且除这些探照灯外无其他光源。熊的朋友不能在熊行走过程中转动探照灯。假设所有探照灯均被调至正确方向后,熊便开始夜行,而他的朋友则去睡觉。

输入格式

The first line contains three space-separated integers n, l, r (1 ≤ n ≤ 20;  - 105 ≤ l ≤ r ≤ 105). The i-th of the next n lines contain three space-separated integers x__i, y__i, a__i ( - 1000 ≤ x__i ≤ 1000; 1 ≤ y__i ≤ 1000; 1 ≤ a__i ≤ 90) — the floodlights' description.

Note that two floodlights can be at the same point of the plane.

第一行包含三个用空格分隔的整数 nn、ll、rr(1 ≤ n ≤ 201 ≤ n ≤ 20;−105 ≤ l ≤ r ≤ 105-10^5 ≤ l ≤ r ≤ 10^5)。接下来的 nn 行中,第 ii 行包含三个用空格分隔的整数 xix_i、yiy_i、aia_i(−1000 ≤ xi ≤ 1000-1000 ≤ x_i ≤ 1000;1 ≤ yi ≤ 10001 ≤ y_i ≤ 1000;1 ≤ ai ≤ 901 ≤ a_i ≤ 90),表示第 ii 个探照灯的参数描述。

注意:两个探照灯可以位于平面上的同一点。

输出格式

Print a single real number — the answer to the problem. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 6.

输出一个实数——该问题的答案。若答案的相对误差或绝对误差不超过 10−610^{-6},则视为正确。

输入输出样例

  • 输入#1

    2 3 5
    3 1 45
    5 1 45

    输出#1

    2.000000000
  • 输入#2

    1 0 1
    1 1 30

    输出#2

    0.732050808
  • 输入#3

    1 0 1
    1 1 45

    输出#3

    1.000000000
  • 输入#4

    1 0 2
    0 2 90

    输出#4

    2.000000000

说明/提示

In the first sample, one of the possible solutions is:

In the second sample, a single solution is:

In the third sample, a single solution is:

在第一个样例中,一种可能的解为:

在第二个样例中,唯一的解为:

在第三个样例中,唯一的解为:

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

首页