QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#372267 | #1950. Surveillance | ohiostatescarlet# | WA | 441ms | 54624kb | Python3 | 1.6kb | 2024-03-31 08:44:46 | 2024-03-31 08:44:47 |
Judging History
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 = [[0, 0]]
inc = a1 / 300000
x = inc
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 += inc
rang.append([a2, b1])
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)
詳細信息
Test #1:
score: 100
Accepted
time: 10ms
memory: 9540kb
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: 0
Accepted
time: 441ms
memory: 54624kb
input:
6 627 -788 444 -788 444 -986 -102 -986 -102 -993 627 -993
output:
1597.4226884990712
result:
ok found '1597.4226885', expected '1597.4226884', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 12ms
memory: 10140kb
input:
6 340 110 340 375 -1000 375 -1000 -135 353 -135 353 110
output:
685624.4401468263
result:
wrong answer 1st numbers differ - expected: '685643.4381452', found: '685624.4401468', error = '0.0000277'