結果

問題 No.622 点と三角柱の内外判定
ユーザー 👑 KazunKazun
提出日時 2021-02-19 02:52:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 834 bytes
コンパイル時間 1,232 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 71,632 KB
最終ジャッジ日時 2023-10-13 10:17:41
合計ジャッジ時間 5,664 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,280 KB
testcase_01 AC 72 ms
71,448 KB
testcase_02 AC 70 ms
71,356 KB
testcase_03 AC 71 ms
71,392 KB
testcase_04 AC 71 ms
71,148 KB
testcase_05 AC 72 ms
71,332 KB
testcase_06 AC 71 ms
71,452 KB
testcase_07 AC 70 ms
71,460 KB
testcase_08 AC 71 ms
71,332 KB
testcase_09 AC 69 ms
71,264 KB
testcase_10 AC 71 ms
71,332 KB
testcase_11 AC 71 ms
71,192 KB
testcase_12 AC 71 ms
71,572 KB
testcase_13 AC 69 ms
71,388 KB
testcase_14 AC 70 ms
71,252 KB
testcase_15 AC 75 ms
71,604 KB
testcase_16 AC 71 ms
71,632 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 70 ms
71,300 KB
testcase_20 AC 72 ms
71,396 KB
testcase_21 WA -
testcase_22 AC 72 ms
71,284 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

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.x
#================================================
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 else "NO")
0