結果

問題 No.2602 Real Collider
ユーザー maeshunmaeshun
提出日時 2024-01-13 14:28:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,378 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 90,520 KB
最終ジャッジ日時 2024-01-13 14:29:35
合計ジャッジ時間 56,027 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
87,688 KB
testcase_01 AC 128 ms
87,688 KB
testcase_02 AC 128 ms
87,688 KB
testcase_03 AC 135 ms
87,688 KB
testcase_04 AC 131 ms
87,688 KB
testcase_05 AC 154 ms
87,688 KB
testcase_06 AC 136 ms
87,688 KB
testcase_07 AC 129 ms
87,688 KB
testcase_08 AC 130 ms
87,688 KB
testcase_09 AC 129 ms
87,688 KB
testcase_10 AC 1,383 ms
89,736 KB
testcase_11 AC 705 ms
89,480 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 578 ms
89,480 KB
testcase_16 AC 778 ms
89,608 KB
testcase_17 AC 816 ms
89,608 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 786 ms
89,480 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 430 ms
89,480 KB
testcase_27 WA -
testcase_28 AC 573 ms
89,480 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 780 ms
89,480 KB
testcase_32 AC 686 ms
89,480 KB
testcase_33 AC 735 ms
89,480 KB
testcase_34 AC 814 ms
89,992 KB
testcase_35 AC 561 ms
89,480 KB
testcase_36 AC 421 ms
89,480 KB
testcase_37 AC 830 ms
89,480 KB
testcase_38 AC 817 ms
89,480 KB
testcase_39 AC 816 ms
89,480 KB
testcase_40 AC 501 ms
89,480 KB
testcase_41 AC 871 ms
89,736 KB
testcase_42 AC 779 ms
90,248 KB
testcase_43 AC 675 ms
89,864 KB
testcase_44 AC 923 ms
89,608 KB
testcase_45 AC 671 ms
90,248 KB
testcase_46 AC 644 ms
89,480 KB
testcase_47 AC 823 ms
89,480 KB
testcase_48 AC 670 ms
89,608 KB
testcase_49 AC 642 ms
89,480 KB
testcase_50 AC 539 ms
89,480 KB
testcase_51 AC 557 ms
89,736 KB
testcase_52 AC 477 ms
89,608 KB
testcase_53 AC 779 ms
89,480 KB
testcase_54 AC 622 ms
89,480 KB
testcase_55 AC 724 ms
89,480 KB
testcase_56 AC 684 ms
89,480 KB
testcase_57 AC 681 ms
89,608 KB
testcase_58 AC 458 ms
89,864 KB
testcase_59 AC 751 ms
89,480 KB
testcase_60 AC 601 ms
89,480 KB
testcase_61 AC 640 ms
90,120 KB
testcase_62 AC 795 ms
89,608 KB
testcase_63 AC 897 ms
89,864 KB
testcase_64 AC 944 ms
89,608 KB
testcase_65 AC 616 ms
90,120 KB
testcase_66 AC 810 ms
89,608 KB
testcase_67 AC 522 ms
89,736 KB
testcase_68 AC 583 ms
89,736 KB
testcase_69 AC 493 ms
89,992 KB
testcase_70 AC 548 ms
89,480 KB
testcase_71 AC 579 ms
89,608 KB
testcase_72 AC 792 ms
89,736 KB
testcase_73 AC 703 ms
89,608 KB
testcase_74 AC 758 ms
89,480 KB
testcase_75 AC 855 ms
89,736 KB
testcase_76 AC 716 ms
89,480 KB
testcase_77 AC 764 ms
89,608 KB
testcase_78 AC 899 ms
89,608 KB
testcase_79 AC 832 ms
90,520 KB
testcase_80 AC 911 ms
89,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction
def main():
    q = int(input())
    x1, y1, x2, y2, x3, y3 = map(int, input().split())
    r = 0
    if (x2 - x1) * (y3 - y1) == (x3 - x1) * (y2 - y1):
        Mx = max(x1, max(x2, x3))
        mx = min(x1, min(x2, x3))
        My = max(y1, max(y2, y3))
        my = min(y1, min(y2, y3))
        r = (Fraction(Mx - mx,2)) ** 2 + (Fraction(My - my,2)) ** 2
        xg = Fraction(mx + Mx,2)
        yg = Fraction(my + My,2)
        for _ in range(q):
            x, y = map(int, input().split())
            R = (xg - x) ** 2 + (yg - y) ** 2
            if R <= r:
                print("Yes")
            else:
                print("No")
    else:
        det = (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)
        m = [[y3 - y1, -y2 + y1], [-x3+x1, x2 -x1]]
        f = [Fraction(x2 ** 2 + y2 ** 2,2) - Fraction(x1 ** 2 + y1 ** 2,2), Fraction(x3 ** 2 + y3 ** 2,2) - Fraction(x1 ** 2 + y1 ** 2,2)]
        e = [m[0][0] * f[0] + m[0][1] * f[1], 
             m[1][0] * f[0] + m[1][1] * f[1]]
        xg = Fraction(e[0],det)
        yg = Fraction(e[1],det)
        r = (xg-x1)**2 + (yg-y1)**2
        for _ in range(q):
            x, y = map(int, input().split())
            R = (xg - x) ** 2 + (yg - y) ** 2
            if R <= r:
                print("Yes")
            else:
                print("No")

if __name__ == "__main__":
    main()
0