結果

問題 No.622 点と三角柱の内外判定
ユーザー startcppstartcpp
提出日時 2017-12-30 13:12:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 52,524 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 11:00:11
合計ジャッジ時間 1,649 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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