結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 38 ms
53,460 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 36 ms
53,460 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 897 ms
76,680 KB
testcase_11 AC 380 ms
76,424 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 303 ms
76,296 KB
testcase_16 AC 436 ms
76,424 KB
testcase_17 AC 472 ms
76,424 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 539 ms
76,424 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 309 ms
76,296 KB
testcase_27 WA -
testcase_28 AC 457 ms
76,424 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 425 ms
76,424 KB
testcase_32 AC 378 ms
76,424 KB
testcase_33 AC 424 ms
76,424 KB
testcase_34 AC 436 ms
76,424 KB
testcase_35 AC 297 ms
76,296 KB
testcase_36 AC 296 ms
76,296 KB
testcase_37 AC 461 ms
76,424 KB
testcase_38 AC 477 ms
76,424 KB
testcase_39 AC 459 ms
76,424 KB
testcase_40 AC 261 ms
76,296 KB
testcase_41 AC 519 ms
76,424 KB
testcase_42 AC 412 ms
76,424 KB
testcase_43 AC 425 ms
76,424 KB
testcase_44 AC 544 ms
76,424 KB
testcase_45 AC 359 ms
76,424 KB
testcase_46 AC 344 ms
76,296 KB
testcase_47 AC 471 ms
76,424 KB
testcase_48 AC 370 ms
76,424 KB
testcase_49 AC 331 ms
76,296 KB
testcase_50 AC 271 ms
76,296 KB
testcase_51 AC 290 ms
76,296 KB
testcase_52 AC 222 ms
76,296 KB
testcase_53 AC 465 ms
76,424 KB
testcase_54 AC 354 ms
76,424 KB
testcase_55 AC 397 ms
76,424 KB
testcase_56 AC 390 ms
76,424 KB
testcase_57 AC 363 ms
76,424 KB
testcase_58 AC 196 ms
76,424 KB
testcase_59 AC 415 ms
76,424 KB
testcase_60 AC 427 ms
76,424 KB
testcase_61 AC 320 ms
76,296 KB
testcase_62 AC 445 ms
76,424 KB
testcase_63 AC 492 ms
76,424 KB
testcase_64 AC 571 ms
76,424 KB
testcase_65 AC 318 ms
76,296 KB
testcase_66 AC 500 ms
76,424 KB
testcase_67 AC 262 ms
76,296 KB
testcase_68 AC 304 ms
76,296 KB
testcase_69 AC 237 ms
76,424 KB
testcase_70 AC 259 ms
76,296 KB
testcase_71 AC 311 ms
76,296 KB
testcase_72 AC 428 ms
76,424 KB
testcase_73 AC 368 ms
76,424 KB
testcase_74 AC 435 ms
76,424 KB
testcase_75 AC 467 ms
76,424 KB
testcase_76 AC 416 ms
76,424 KB
testcase_77 AC 424 ms
76,424 KB
testcase_78 AC 511 ms
76,424 KB
testcase_79 AC 478 ms
76,424 KB
testcase_80 AC 510 ms
76,424 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
    r2 = (x - x1 * det) ** 2 + (y - y1 * det) ** 2
    return x, y, r2, det


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

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