結果
問題 | No.2602 Real Collider |
ユーザー |
👑 |
提出日時 | 2024-01-12 22:24:33 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,130 bytes |
コンパイル時間 | 265 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 77,452 KB |
最終ジャッジ日時 | 2024-09-27 22:54:32 |
合計ジャッジ時間 | 34,787 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 65 WA * 13 |
ソースコード
# https://tjkendev.github.io/procon-library/python/geometry/circles_associated_with_triangle.htmldef circumcircle(P1, P2, P3):x1, y1 = P1x2, y2 = P2x3, y3 = P3a = 2 * (x1 - x2)b = 2 * (y1 - y2)p = x1**2 - x2**2 + y1**2 - y2**2c = 2 * (x1 - x3)d = 2 * (y1 - y3)q = x1**2 - x3**2 + y1**2 - y3**2det = a * d - b * cif det == 0:return Nonex = d * p - b * qy = a * q - c * pif det < 0:x = -xy = -ydet = -detr2 = (x - x1 * det) ** 2 + (y - y1 * det) ** 2return x, y, r2, detQ = int(input())xa, ya, xb, yb, xc, yc = map(int, input().split())res = circumcircle((xa, ya), (xb, yb), (xc, yc))if res is None:Ps = [(xa, ya), (xb, yb), (xc, yc)]Ps.sort()x1, y1 = Ps[0]x2, y2 = Ps[2]cx = x1 + x2cy = y1 + y2det = 2r2 = (cx - 2 * x1) ** 2 + (cy - 2 * y1) ** 2else:cx, cy, r2, det = resfor _ in range(Q):x, y = map(int, input().split())x *= dety *= detd2 = (x - cx) ** 2 + (y - cy) ** 2if d2 <= r2:print("Yes")else:print("No")