結果
| 問題 | No.622 点と三角柱の内外判定 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-12-22 00:24:58 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,461 bytes | 
| コンパイル時間 | 1,944 ms | 
| コンパイル使用メモリ | 193,960 KB | 
| 最終ジャッジ日時 | 2025-01-05 06:09:52 | 
| ジャッジサーバーID (参考情報) | judge4 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 15 WA * 17 | 
ソースコード
#include <bits/stdc++.h>
#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}
template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}
constexpr ll MOD = (ll)1e9 + 7LL;
constexpr ld PI = static_cast<ld>(3.1415926535898);
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;
struct Vec {
    ll dx;
    ll dy;
    ll dz;
    ll dot(const Vec& v)
    {
        return (dx * v.dx + dy * v.dy + dz * v.dz);
    }
};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4;
    cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> x3 >> y3 >> z3 >> x4 >> y4 >> z4;
    Vec v1{x2 - x1, y2 - y1, z2 - z1};
    Vec v2{x3 - x1, y3 - y1, z3 - z1};
    Vec v3{x4 - x1, y4 - y1, z4 - z1};
    const ll ab = v1.dot(v2);
    const ll n1 = v1.dot(v1);
    const ll n2 = v2.dot(v2);
    const ll ac = v1.dot(v3);
    const ll bc = v2.dot(v3);
    const ll x = n2 * ac - ab * bc;
    const ll y = -ab * ac + n1 * bc;
    cout << (x + y < n1 * n2 - ab * ab ? "YES" : "NO") << endl;
    return 0;
}
            
            
            
        