結果

問題 No.2602 Real Collider
ユーザー 👑 rin204rin204
提出日時 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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,668 KB
testcase_01 AC 39 ms
53,556 KB
testcase_02 AC 38 ms
53,228 KB
testcase_03 AC 41 ms
54,216 KB
testcase_04 AC 39 ms
52,940 KB
testcase_05 AC 41 ms
53,476 KB
testcase_06 AC 40 ms
54,228 KB
testcase_07 AC 41 ms
53,008 KB
testcase_08 AC 40 ms
52,740 KB
testcase_09 AC 40 ms
53,216 KB
testcase_10 AC 968 ms
76,904 KB
testcase_11 AC 413 ms
76,316 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 337 ms
76,388 KB
testcase_16 AC 467 ms
76,452 KB
testcase_17 AC 505 ms
76,852 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 588 ms
76,824 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 335 ms
77,068 KB
testcase_27 WA -
testcase_28 AC 500 ms
76,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 465 ms
76,708 KB
testcase_32 AC 417 ms
76,688 KB
testcase_33 AC 471 ms
76,264 KB
testcase_34 AC 470 ms
76,844 KB
testcase_35 AC 324 ms
76,516 KB
testcase_36 AC 322 ms
76,672 KB
testcase_37 AC 510 ms
76,372 KB
testcase_38 AC 518 ms
76,672 KB
testcase_39 AC 500 ms
76,272 KB
testcase_40 AC 287 ms
76,652 KB
testcase_41 AC 563 ms
77,148 KB
testcase_42 AC 457 ms
76,452 KB
testcase_43 AC 464 ms
77,052 KB
testcase_44 AC 564 ms
76,384 KB
testcase_45 AC 385 ms
76,172 KB
testcase_46 AC 364 ms
76,584 KB
testcase_47 AC 509 ms
76,644 KB
testcase_48 AC 407 ms
76,636 KB
testcase_49 AC 362 ms
76,792 KB
testcase_50 AC 296 ms
76,516 KB
testcase_51 AC 311 ms
76,376 KB
testcase_52 AC 245 ms
76,720 KB
testcase_53 AC 475 ms
76,660 KB
testcase_54 AC 387 ms
76,508 KB
testcase_55 AC 422 ms
76,508 KB
testcase_56 AC 418 ms
76,388 KB
testcase_57 AC 400 ms
76,448 KB
testcase_58 AC 211 ms
76,448 KB
testcase_59 AC 455 ms
76,340 KB
testcase_60 AC 425 ms
76,384 KB
testcase_61 AC 344 ms
76,268 KB
testcase_62 AC 478 ms
76,780 KB
testcase_63 AC 532 ms
76,704 KB
testcase_64 AC 604 ms
77,084 KB
testcase_65 AC 343 ms
76,264 KB
testcase_66 AC 503 ms
76,320 KB
testcase_67 AC 281 ms
76,256 KB
testcase_68 AC 320 ms
76,260 KB
testcase_69 AC 248 ms
76,808 KB
testcase_70 AC 282 ms
76,384 KB
testcase_71 AC 335 ms
76,396 KB
testcase_72 AC 460 ms
76,916 KB
testcase_73 AC 398 ms
76,416 KB
testcase_74 AC 469 ms
76,472 KB
testcase_75 AC 504 ms
76,584 KB
testcase_76 AC 442 ms
76,500 KB
testcase_77 AC 461 ms
76,448 KB
testcase_78 AC 551 ms
76,796 KB
testcase_79 AC 488 ms
76,528 KB
testcase_80 AC 556 ms
76,320 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