CF2172I.Birthday
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Anon and Soyo are good friends. To celebrate Anon's birthday, Soyo decides to buy a cake. After careful selection, she chooses a round strawberry cake to share with Anon at home.
The cake is modeled as a circle centered at the origin (0,0) with radius r. There are n strawberries on the cake, where the i-th strawberry is located at (xi,yi). The distance of any strawberry from the origin is at most 0.9r.
Soyo wants to cut the cake into two pieces with a single straight line. Since Anon loves strawberries, Soyo wants Anon's piece contains all of them. If a strawberry lies on the cutting line, Soyo can assign it to either piece.
Soyo wants to make the smaller piece as large as possible. Please help Soyo determine the maximum possible area of the smaller piece, given that all strawberries lie on the same piece.
Anon 和 Soyo 是好朋友。为庆祝 Anon 的生日,Soyo 决定买一个蛋糕。经过精心挑选,她选择了一个圆形的草莓蛋糕,准备带回家与 Anon 一起分享。
该蛋糕被建模为一个以原点 (0,0) 为圆心、半径为 r 的圆。蛋糕上有 n 颗草莓,其中第 i 颗草莓位于 (xi,yi)。任意一颗草莓到原点的距离至多为 0.9r。
Soyo 想用一条直线将蛋糕切成两块。由于 Anon 喜欢草莓,Soyo 希望 Anon 分得的那一块包含全部草莓。若某颗草莓恰好落在切割线上,则 Soyo 可将其任意分配给其中一块。
Soyo 希望使较小的那块面积尽可能大。请帮助 Soyo 计算在所有草莓均位于同一块的前提下,较小块所能达到的最大面积。
输入格式
The first line contains two integers n and r, representing the number of strawberries on the cake and the radius of the cake, respectively.
The i-th of the following n lines contains two integers xi and yi, representing the coordinates of the i-th strawberry.
- 1≤n≤2×105
- 1≤r≤106
- xi2+yi2≤0.9r
- All strawberries are at distinct points.
第一行包含两个整数 n 和 r,分别表示蛋糕上的草莓数量和蛋糕的半径。
接下来的 n 行中,第 i 行包含两个整数 xi 和 yi,表示第 i 颗草莓的坐标。
- 1≤n≤2×105
- 1≤r≤106
- xi2+yi2≤0.9r
- 所有草莓均位于互不相同的点上。
输出格式
Print a single real number in one line, representing the maximum possible area of the smaller piece, given that all strawberries lie on the same piece.
Your answer will be accepted if the absolute or relative error does not exceed 10−6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if max(1,∣b∣)∣a−b∣≤10−6.
在一行中输出一个实数,表示在所有草莓都位于同一块蛋糕上的前提下,较小那块蛋糕的最大可能面积。
若你的答案的绝对误差或相对误差不超过 10−6,则该答案将被接受。形式化地说,设你的答案为 a,评测组的答案为 b,当且仅当 max(1,∣b∣)∣a−b∣≤10−6 时,你的答案被视为正确。
输入输出样例
输入#1
4 5 -3 -3 3 -3 -3 3 3 3
输出#1
11.182380450040
输入#2
7 15 9 -4 2 -2 8 3 0 4 -6 10 6 6 3 5
输出#2
353.429173528852
输入#3
15 15 -4 -1 0 -1 2 -9 0 2 8 1 3 -3 -9 3 8 6 9 7 -9 -1 2 6 -2 7 -10 -8 4 0 -5 -8
输出#3
168.906562205067
输入解题思路,AI测评打分。不知道怎么写?