結果
問題 | No.622 点と三角柱の内外判定 |
ユーザー |
👑 ![]() |
提出日時 | 2021-02-19 03:28:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 41 ms / 1,500 ms |
コード長 | 855 bytes |
コンパイル時間 | 285 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 52,352 KB |
最終ジャッジ日時 | 2024-09-15 07:45:47 |
合計ジャッジ時間 | 2,608 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
ソースコード
class P:def __init__(self,x,y,z):self.x=xself.y=yself.z=zdef __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-Aa=p*p;b=c=p*q;d=q*qs=(D-A)*p;t=(D-A)*qdet=a*d-b*calpha=(d*s-b*t)/detbeta =(-c*s+a*t)/detprint("YES" if 0<=alpha<=1 and 0<=beta<=1 and 0<=alpha+beta<=1 else "NO")