結果
| 問題 |
No.2602 Real Collider
|
| コンテスト | |
| ユーザー |
naut3
|
| 提出日時 | 2024-01-12 22:41:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,315 bytes |
| コンパイル時間 | 273 ms |
| コンパイル使用メモリ | 82,164 KB |
| 実行使用メモリ | 76,840 KB |
| 最終ジャッジ日時 | 2024-09-27 23:25:20 |
| 合計ジャッジ時間 | 20,499 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 72 WA * 6 |
ソースコード
def minimum_bounding_circle(p1, p2, p3):
def dist(q1, q2):
x1, y1 = q1
x2, y2 = q2
return (x1 - x2) ** 2 + (y1 - y2) ** 2
def add(q1, q2):
x1, y1 = q1
x2, y2 = q2
return (x1 + x2, y1 + y2)
def mul(a, q1):
x1, y1 = q1
return (a * x1, a * y1)
A = dist(p2, p3)
B = dist(p3, p1)
C = dist(p1, p2)
sa, sb, sc = sorted([A, B, C])
if sa + sb <= sc + 1e-7:
c = add(p2, p3) if A == sc else add(p1, p3) if B == sc else add(p1, p2)
c = mul(1/2, c)
r2 = sc / 4
else:
T = A * (B + C - A)
U = B * (C + A - B)
W = C * (A + B - C)
c = mul(1 / (T + U + W), add(add(mul(T, p1), mul(U, p2)), mul(W, p3)))
r2 = (dist(c, p1) + dist(c, p2) + dist(c, p3)) / 3
return c, r2
def main():
Q = int(input())
Xa, Ya, Xb, Yb, Xc, Yc = map(int, input().split())
(cx, cy), r = minimum_bounding_circle((Xa, Ya), (Xb, Yb), (Xc, Yc))
def dist(q1, q2):
x1, y1 = q1
x2, y2 = q2
return (x1 - x2) ** 2 + (y1 - y2) ** 2
for _ in range(Q):
xq, yq = map(int, input().split())
d = dist((xq, yq), (cx, cy))
if d <= r + 1e-7:
print("Yes")
else:
print("No")
return 0
main()
naut3