编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#114714 #1012. L. 注重风控,风火轮模型 Wrong Answer 0 69 ms 3044 K Python 3 / 2.1 K nocriz🦆 2024-09-13 9:21:59
import math

def circle_circle_intersection(x0, y0, r0, x1, y1, r1):
    d = math.hypot(x1 - x0, y1 - y0)
    if d > r0 + r1:
        return []  # No intersection.
    if d < abs(r0 - r1):
        return []  # One circle is contained within the other.
    if d == 0 and r0 == r1:
        return []  # Circles are coincident.
    else:
        a = (r0**2 - r1**2 + d**2) / (2 * d)
        h = math.sqrt(max(0, r0**2 - a**2))
        x2 = x0 + a * (x1 - x0) / d
        y2 = y0 + a * (y1 - y0) / d
        rx = -(y1 - y0) * (h / d)
        ry = -(x1 - x0) * (h / d)
        xi1 = x2 + rx
        xi2 = x2 - rx
        yi1 = y2 - ry
        yi2 = y2 + ry
        return [(xi1, yi1), (xi2, yi2)]

def compute_total_distance(n, r, points):
    O_x, O_y = 0.0, 0.0  # Assuming the circle is centered at (0, 0).
    total_length = 0.0
    for i in range(n):
        P_i = points[i]
        P_next = points[(i + 1) % n]
        s_x, s_y = P_next[0] - P_i[0], P_next[1] - P_i[1]
        s_angle = math.atan2(s_y, s_x)
        # Circle centered at P_i
        r0 = math.hypot(s_x, s_y)
        x0, y0 = P_i[0], P_i[1]
        # Circle centered at O
        r1 = r
        x1, y1 = O_x, O_y
        intersections = circle_circle_intersection(x0, y0, r0, x1, y1, r1)
        min_theta = None
        for xi, yi in intersections:
            v_x, v_y = xi - P_i[0], yi - P_i[1]
            v_angle = math.atan2(v_y, v_x)
            theta = (s_angle - v_angle) % (2 * math.pi)
            if theta <= 0:
                theta += 2 * math.pi
            if min_theta is None or theta < min_theta:
                min_theta = theta
        if min_theta is not None:
            d_i1 = math.hypot(points[0][0] - P_i[0], points[0][1] - P_i[1])
            total_length += d_i1 * min_theta
        else:
            continue  # No valid rotation, skip.
    return total_length

# Read input
n, r = map(float, input().split())
n = int(n)
points = [tuple(map(float, input().split())) for _ in range(n)]

# Compute and print the total distance
total_distance = compute_total_distance(n, r, points)
print(total_distance)
子任务 #1
Wrong Answer
得分:0
测试点 #1
Wrong Answer
得分:0
用时:14 ms
内存:2940 KiB

输入文件(1.in

3 35941
583.04714 3121.03022
1806.86186 1416.16563
4984.18545 200.02605

答案文件(1.ans

15854.07033788921762607060

用户输出

0.0

Special Judge 信息

Error(15854.07033788921762607060) too large

系统信息

Exited with return code 0
测试点 #2
Wrong Answer
得分:0
用时:13 ms
内存:3020 KiB

输入文件(2.in

15 21331
504.05781 3250.88951
1718.34697 1497.03649
3702.66308 378.64555
4424.20987 234.65996
4821.3
<235 bytes omitted>

答案文件(2.ans

29335.84794469948246842250

用户输出

0.0

Special Judge 信息

Error(29335.84794469948246842250) too large

系统信息

Exited with return code 0
测试点 #3
Wrong Answer
得分:0
用时:15 ms
内存:3044 KiB

输入文件(3.in

15 35155
1903.22247 1332.58007
2542.13948 884.86186
4344.54468 244.96285
5745.72528 258.28156
7454.5
<234 bytes omitted>

答案文件(3.ans

32799.81410184111882699654

用户输出

0.0

Special Judge 信息

Error(32799.81410184111882699654) too large

系统信息

Exited with return code 0
测试点 #4
Wrong Answer
得分:0
用时:14 ms
内存:3040 KiB

输入文件(4.in

100 21315
202.73110 4838.10150
207.03370 4740.24226
222.70360 4533.69633
233.73077 4431.95278
304.67
<2075 bytes omitted>

答案文件(4.ans

29761.25504531784099526703

用户输出

0.0

Special Judge 信息

Error(29761.25504531784099526703) too large

系统信息

Exited with return code 0
测试点 #5
Wrong Answer
得分:0
用时:13 ms
内存:3036 KiB

输入文件(5.in

100 34201
202.23054 4853.68467
206.74735 4745.58106
289.91929 4075.26238
488.79146 3360.18368
513.94
<2079 bytes omitted>

答案文件(5.ans

32998.22863424615934491158

用户输出

0.0

Special Judge 信息

Error(32998.22863424615934491158) too large

系统信息

Exited with return code 0