結果

問題 No.2602 Real Collider
ユーザー 👑 rin204rin204
提出日時 2024-01-12 22:22:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,117 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,008 KB
最終ジャッジ日時 2024-01-12 22:23:03
合計ジャッジ時間 21,221 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 40 ms
53,460 KB
testcase_04 WA -
testcase_05 AC 36 ms
53,460 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 238 ms
76,000 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 191 ms
76,008 KB
testcase_16 AC 275 ms
76,008 KB
testcase_17 AC 282 ms
76,008 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 304 ms
76,008 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 190 ms
76,008 KB
testcase_27 WA -
testcase_28 AC 260 ms
76,008 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 250 ms
76,008 KB
testcase_32 AC 225 ms
76,008 KB
testcase_33 AC 259 ms
76,008 KB
testcase_34 AC 266 ms
76,008 KB
testcase_35 AC 194 ms
76,008 KB
testcase_36 AC 183 ms
76,008 KB
testcase_37 AC 278 ms
76,008 KB
testcase_38 AC 283 ms
76,008 KB
testcase_39 AC 267 ms
76,008 KB
testcase_40 AC 185 ms
76,008 KB
testcase_41 AC 307 ms
76,008 KB
testcase_42 AC 244 ms
76,008 KB
testcase_43 AC 248 ms
76,008 KB
testcase_44 AC 308 ms
76,008 KB
testcase_45 AC 219 ms
76,008 KB
testcase_46 AC 203 ms
76,008 KB
testcase_47 AC 284 ms
76,008 KB
testcase_48 AC 235 ms
76,008 KB
testcase_49 AC 218 ms
76,008 KB
testcase_50 AC 174 ms
76,008 KB
testcase_51 AC 182 ms
76,008 KB
testcase_52 AC 151 ms
76,008 KB
testcase_53 AC 262 ms
76,008 KB
testcase_54 AC 214 ms
76,008 KB
testcase_55 AC 228 ms
76,008 KB
testcase_56 AC 229 ms
76,008 KB
testcase_57 AC 214 ms
76,008 KB
testcase_58 AC 131 ms
76,008 KB
testcase_59 AC 257 ms
76,008 KB
testcase_60 AC 239 ms
76,008 KB
testcase_61 AC 196 ms
76,008 KB
testcase_62 AC 255 ms
76,008 KB
testcase_63 AC 293 ms
76,008 KB
testcase_64 AC 322 ms
76,008 KB
testcase_65 AC 191 ms
76,008 KB
testcase_66 AC 263 ms
76,008 KB
testcase_67 AC 175 ms
76,008 KB
testcase_68 AC 192 ms
76,008 KB
testcase_69 AC 154 ms
76,008 KB
testcase_70 AC 162 ms
76,008 KB
testcase_71 AC 199 ms
76,008 KB
testcase_72 AC 286 ms
75,996 KB
testcase_73 AC 220 ms
76,008 KB
testcase_74 AC 271 ms
76,008 KB
testcase_75 AC 265 ms
76,008 KB
testcase_76 AC 248 ms
76,008 KB
testcase_77 AC 250 ms
76,008 KB
testcase_78 AC 303 ms
76,008 KB
testcase_79 AC 266 ms
76,008 KB
testcase_80 AC 283 ms
76,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# https://tjkendev.github.io/procon-library/python/geometry/circles_associated_with_triangle.html
def circumcircle(P1, P2, P3):
    x1, y1 = P1
    x2, y2 = P2
    x3, y3 = P3
    a = 2 * (x1 - x2)
    b = 2 * (y1 - y2)
    p = x1**2 - x2**2 + y1**2 - y2**2
    c = 2 * (x1 - x3)
    d = 2 * (y1 - y3)
    q = x1**2 - x3**2 + y1**2 - y3**2
    det = a * d - b * c
    if det == 0:
        return None
    x = d * p - b * q
    y = a * q - c * p
    if det < 0:
        x = -x
        y = -y
        det = -det
    x /= det
    y /= det
    r2 = (x - x1) ** 2 + (y - y1) ** 2
    return x, y, r2


Q = 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 + x2) / 2
    cy = (y1 + y2) / 2
    r2 = (cx - x1) ** 2 + (cy - y1) ** 2
else:
    cx, cy, r2 = res

eps = 1e-7
for _ in range(Q):
    x, y = map(int, input().split())
    d2 = (x - cx) ** 2 + (y - cy) ** 2
    if d2 <= r2 + eps:
        print("Yes")
    else:
        print("No")
0