結果
| 問題 | No.132 点と平面との距離 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-09-06 16:45:55 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,066 bytes | 
| コンパイル時間 | 2,821 ms | 
| コンパイル使用メモリ | 177,664 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-06-12 04:11:56 | 
| 合計ジャッジ時間 | 11,114 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 1 TLE * 1 -- * 1 | 
ソースコード
import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.regex, std.conv, std.stdio, std.typecons;
struct point {
  real x, y, z;
}
void main()
{
  auto n = readln.chomp.to!size_t;
  auto ai = iota(n + 1)
    .map!(_ => readln.split.map!(to!real))
    .map!(rd => point(rd[0], rd[1], rd[2])).array;
  auto p = ai.front;
  auto qi = ai[1..$];
  auto bi = new bool[](n);
  bi[3..$] = true;
  real s = 0;
  do {
    auto r = qi.zip(bi).filter!("!a[1]").map!("a[0]").array;
    auto a = (r[1].y - r[0].y) * (r[2].z - r[0].z) - (r[2].y - r[0].y) * (r[1].z - r[0].z);
    auto b = (r[1].z - r[0].z) * (r[2].x - r[0].x) - (r[2].z - r[0].z) * (r[1].x - r[0].x);
    auto c = (r[1].x - r[0].x) * (r[2].y - r[0].y) - (r[2].x - r[0].x) * (r[1].y - r[0].y);
    auto d = -(a * r[0].x + b * r[0].y + c * r[0].z);
    auto t = (a * p.x + b * p.y + c * p.z + d).abs / (a ^^ 2 + b ^^ 2 + c ^^ 2).sqrt;
    s += t;
  } while(bi.nextPermutation);
  writefln("%.9f", s);
}
            
            
            
        