結果

問題 No.622 点と三角柱の内外判定
ユーザー startcpp
提出日時 2017-12-30 13:12:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 941 ms
コンパイル使用メモリ 55,364 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-21 13:12:04
合計ジャッジ時間 1,274 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#define int long long
using namespace std;

struct Point {
	int x, y, z;
	Point() {}
	Point(int x, int y, int z) { this->x = x; this->y = y; this->z = z; }
	static int dot(Point l, Point r) { return l.x * r.x + l.y * r.y + l.z * r.z; }
};
Point operator-(const Point l, const Point r) { return Point(l.x - r.x, l.y - r.y, l.z - r.z); }

Point p[4];

signed main() {
	int i;
	for (i = 0; i < 4; i++) cin >> p[i].x >> p[i].y >> p[i].z;
	int a = Point::dot(p[1] - p[0], p[3] - p[0]);
	int b = Point::dot(p[2] - p[1], p[3] - p[1]);
	int c = Point::dot(p[0] - p[2], p[3] - p[2]);
	if (a >= 0 && b >= 0 && c >= 0) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}
0