結果
問題 |
No.622 点と三角柱の内外判定
|
ユーザー |
👑 ![]() |
提出日時 | 2021-02-19 02:52:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 834 bytes |
コンパイル時間 | 1,583 ms |
コンパイル使用メモリ | 81,988 KB |
実行使用メモリ | 54,364 KB |
最終ジャッジ日時 | 2024-09-15 07:23:20 |
合計ジャッジ時間 | 2,856 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 12 |
ソースコード
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")