結果
| 問題 | No.132 点と平面との距離 | 
| コンテスト | |
| ユーザー |  ytft | 
| 提出日時 | 2021-03-14 19:09:37 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,406 bytes | 
| コンパイル時間 | 6,637 ms | 
| コンパイル使用メモリ | 332,236 KB | 
| 実行使用メモリ | 10,404 KB | 
| 最終ジャッジ日時 | 2024-11-06 08:30:03 | 
| 合計ジャッジ時間 | 17,104 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 1 TLE * 1 -- * 1 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
typedef mp::number<mp::cpp_dec_float<100>> d;
int main(){
    int N;
    cin>>N;
    vector<mp::cpp_dec_float_100> P(3);
    for(int i=0;i<3;i++){
        cin>>P[i];
    }
    vector<vector<mp::cpp_dec_float_100>> Q(N,vector<mp::cpp_dec_float_100>(3));
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            cin>>Q[i][j];
            Q[i][j]-=P[j];
        }
    }
    vector<mp::cpp_dec_float_100> a(3),b(3),law(3);
    mp::cpp_dec_float_100 length;
    mp::cpp_dec_float_100 product;
    mp::cpp_dec_float_100 ans=0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                for(int l=0;l<3;l++){
                    a[l]=Q[i][l]-Q[k][l];
                    b[l]=Q[j][l]-Q[k][l];
                } 
                length=0;
                for(int l=0;l<3;l++){
                    law[l]=a[(l+1)%3]*b[(l+2)%3]-a[(l+2)%3]*b[(l+1)%3];
                    length+=law[l]*law[l];
                }
                length=mp::sqrt(length);
                product=0;
                for(int l=0;l<3;l++){
                    product+=law[l]*Q[k][l];
                }
                ans+=abs(product/length);
            }
        }
    }
    cout << std::fixed << std::setprecision(15) << ans << endl;
}
            
            
            
        