結果
| 問題 | No.132 点と平面との距離 | 
| コンテスト | |
| ユーザー |  はむ吉🐹 | 
| 提出日時 | 2016-08-26 15:57:19 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 1,517 bytes | 
| コンパイル時間 | 163 ms | 
| コンパイル使用メモリ | 82,428 KB | 
| 実行使用メモリ | 78,228 KB | 
| 最終ジャッジ日時 | 2024-11-08 04:11:09 | 
| 合計ジャッジ時間 | 7,670 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 TLE * 1 | 
ソースコード
#!/usr/bin/env pypy3
import collections
import itertools
import math
class Vector3(collections.namedtuple("Vector3", "x y z")):
    __slots__ = ()
    def __add__(self, other):
        return Vector3(*(s + o for s, o in zip(self, other)))
    def __sub__(self, other):
        return Vector3(*(s - o for s, o in zip(self, other)))
    def __mul__(self, other):  # cross product
        m1 = self.y * other.z - self.z * other.y
        m2 = self.z * other.x - self.x * other.z
        m3 = self.x * other.y - self.y * other.x
        return Vector3(m1, m2, m3)
    def __neg__(self):
        return Vector3(-self.x, -self.y, -self.z)
    def __pos__(self):
        return Vector3(+self.x, +self.y, +self.z)
    def __abs__(self):  # norm
        return math.sqrt(sum(s * s for s in self))
    def dotproduct(self, other):
        return sum(s * o for s, o in zip(self, other))
    def angle(self, other):
        return math.acos(self.dotproduct(other) / abs(self) / abs(other))
    def scale(self, k):
        return Vector3(k * self.x, k * self.y, k * self.z)
def dist(q1, q2, q3):
    v1 = q2 - q1
    v2 = q3 - q2
    cp = v1 * v2
    return abs(q1.dotproduct(cp)) / abs(cp)
def solve(p, qs):
    return sum(dist(*q123) for q123 in itertools.combinations(qs, 3))
def main():
    n = int(input())
    p = Vector3(*map(float, input().split()))
    qs = [Vector3(*map(float, input().split())) - p for _ in range(n)]
    print("{:.12f}".format(solve(p, qs)))
if __name__ == '__main__':
    main()
            
            
            
        