QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#372264 | #1950. Surveillance | ohiostatescarlet# | WA | 143ms | 24628kb | Python3 | 1.6kb | 2024-03-31 08:30:50 | 2024-03-31 08:30:50 |
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 = []
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'