結果

問題 No.622 点と三角柱の内外判定
ユーザー 👑 KazunKazun
提出日時 2021-02-19 03:28:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 1,500 ms
コード長 855 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 71,432 KB
最終ジャッジ日時 2023-10-13 10:43:10
合計ジャッジ時間 5,044 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,364 KB
testcase_01 AC 73 ms
71,184 KB
testcase_02 AC 72 ms
71,176 KB
testcase_03 AC 72 ms
71,352 KB
testcase_04 AC 73 ms
71,300 KB
testcase_05 AC 73 ms
71,344 KB
testcase_06 AC 72 ms
71,136 KB
testcase_07 AC 72 ms
71,292 KB
testcase_08 AC 73 ms
71,328 KB
testcase_09 AC 72 ms
71,028 KB
testcase_10 AC 72 ms
71,116 KB
testcase_11 AC 71 ms
70,948 KB
testcase_12 AC 73 ms
71,300 KB
testcase_13 AC 73 ms
71,076 KB
testcase_14 AC 73 ms
71,388 KB
testcase_15 AC 72 ms
71,244 KB
testcase_16 AC 73 ms
71,344 KB
testcase_17 AC 72 ms
71,168 KB
testcase_18 AC 73 ms
70,940 KB
testcase_19 AC 72 ms
71,348 KB
testcase_20 AC 73 ms
71,228 KB
testcase_21 AC 73 ms
71,232 KB
testcase_22 AC 74 ms
71,268 KB
testcase_23 AC 74 ms
71,348 KB
testcase_24 AC 72 ms
71,432 KB
testcase_25 AC 75 ms
71,080 KB
testcase_26 AC 72 ms
71,300 KB
testcase_27 AC 73 ms
71,084 KB
testcase_28 AC 74 ms
71,084 KB
testcase_29 AC 73 ms
71,140 KB
testcase_30 AC 73 ms
71,352 KB
testcase_31 AC 72 ms
70,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class P:
    def __init__(self,x,y,z):
        self.x=x
        self.y=y
        self.z=z

    def __str__(self):
        return "({}, {}, {})".format(self.x,self.y,self.z)

    def __repr__(self):
        return str(self)

    def __neg__(self):
        return P(-self.x,-self.y,-self.z)

    def __sub__(self,other):
        return P(self.x-other.x,self.y-other.y,self.z-other.z)

    def __mul__(self,other):
        return self.x*other.x+self.y*other.y+self.z*other.z
#================================================
A=P(*tuple(map(int,input().split())))
B=P(*tuple(map(int,input().split())))
C=P(*tuple(map(int,input().split())))
D=P(*tuple(map(int,input().split())))

p=B-A;q=C-A
a=p*p;b=c=p*q;d=q*q
s=(D-A)*p;t=(D-A)*q
det=a*d-b*c

alpha=(d*s-b*t)/det
beta =(-c*s+a*t)/det

print("YES" if 0<=alpha<=1 and 0<=beta<=1 and 0<=alpha+beta<=1 else "NO")
0