結果

問題 No.622 点と三角柱の内外判定
ユーザー t98slidert98slider
提出日時 2023-07-20 01:44:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 888 bytes
コンパイル時間 1,524 ms
コンパイル使用メモリ 168,840 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 03:31:51
合計ジャッジ時間 2,935 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 WA -
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 WA -
testcase_27 AC 2 ms
4,348 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

struct point{
    ll x, y, z;
    point& operator -= (const point& rhs) {
        x -= rhs.x, y -= rhs.y, z -= rhs.z; 
        return *this;
    }
    friend point operator - (const point& lhs, const point& rhs) {return point(lhs) -= rhs;}
    friend istream& operator >> (istream& os, point& rhs) noexcept {
        os >> rhs.x >> rhs.y >> rhs.z;
        return os;
    }
    friend ll operator * (const point& lhs, const point& rhs) {
        return lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z;
    }
};

int main(){
    vector<point> a(4);
    for(int i = 0; i < 4; i++) cin >> a[i];
    for(int i = 0; i < 3; i++){
        point p1 = a[3] - a[i], p2 = a[(i + 1) % 3] - a[i];
        if(!(0 <= p1 * p2 && p1 * p2 <= p2 * p2)){
            cout << "NO\n";
            exit(0);
        }
    }
    cout << "YES\n";
}
0