QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#372264#1950. Surveillanceohiostatescarlet#WA 143ms24628kbPython31.6kb2024-03-31 08:30:502024-03-31 08:30:50

Judging History

你现在查看的是最新测评结果

  • [2024-03-31 08:30:50]
  • 评测
  • 测评结果:WA
  • 用时:143ms
  • 内存:24628kb
  • [2024-03-31 08:30:50]
  • 提交

answer

import math

n = int(input())

points = [list(map(int, input().split())) for _ in range(n)]

xs = [p[0] for p in points]
ys = [p[1] for p in points]

xmax = max(xs)
ymax = max(ys)
xmin = min(xs)
ymin = min(ys)

atotal = xmax - xmin
btotal = ymax - ymin

found = False
for i in range(len(points)):
    if points[i][0] not in [xmin, xmax] and points[i][1] not in [ymin, ymax]:
        a2 = max(abs(points[i][0] - points[(i + 1) % n][0]), abs(points[i][0] - points[(i - 1) % n][0]))
        b2 = max(abs(points[i][1] - points[(i + 1) % n][1]), abs(points[i][1] - points[(i - 1) % n][1]))
        found = True
        break


def solve(a1, a2, b1, b2):
    rang = []

    x = 0.00000001
    while True:
        theta1 = math.atan(b2 / x)
        theta2 = math.atan(b2 / (2*a1 - x))
        theta3 = math.pi - theta1 - theta2
        d1 = b1 / math.tan(theta1)
        d2 = 2 * d1 * math.sin(theta1) / math.sin(theta3)

        dx = d2 * math.cos(theta2)
        dy = d2 * math.sin(theta2)

        # print(x, d2, dx, dy)

        if dx > a2 or dy > b1:
            break

        rang.append([dx, dy])

        x += a1 / 100000

    total = 0
    for i in range(len(rang)-1):
        total += (rang[i+1][0] - rang[i][0]) * (rang[i+1][1] + rang[i][1]) / 2
    return total


if not found:
    print(atotal * btotal)
else:
    a1 = atotal - a2
    b1 = btotal - b2

    # print(atotal, a1, a2)
    # print(btotal, b1, b2)

    total = 0

    total += solve(a1, a2, b1, b2)
    total += solve(b1, b2, a1, a2)

    print(atotal * btotal - a2 * b2 -total)



Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 9636kb

input:

4
-5 6
-5 -2
10 -2
10 6

output:

120

result:

ok found '120.0000000', expected '120.0000000', error '0.0000000'

Test #2:

score: -100
Wrong Answer
time: 143ms
memory: 24628kb

input:

6
627 -788
444 -788
444 -986
-102 -986
-102 -993
627 -993

output:

41178.7886558282

result:

wrong answer 1st numbers differ - expected: '1597.4226884', found: '41178.7886558', error = '24.7782671'