結果

問題 No.622 点と三角柱の内外判定
ユーザー hiragnhiragn
提出日時 2022-11-01 04:23:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 143 ms / 1,500 ms
コード長 643 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 31,840 KB
最終ジャッジ日時 2023-09-23 00:44:12
合計ジャッジ時間 8,361 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
31,640 KB
testcase_01 AC 132 ms
29,980 KB
testcase_02 AC 130 ms
31,608 KB
testcase_03 AC 133 ms
30,116 KB
testcase_04 AC 130 ms
30,192 KB
testcase_05 AC 133 ms
30,180 KB
testcase_06 AC 133 ms
30,024 KB
testcase_07 AC 134 ms
30,160 KB
testcase_08 AC 132 ms
30,028 KB
testcase_09 AC 132 ms
30,104 KB
testcase_10 AC 132 ms
30,076 KB
testcase_11 AC 131 ms
29,984 KB
testcase_12 AC 143 ms
29,984 KB
testcase_13 AC 131 ms
30,032 KB
testcase_14 AC 131 ms
30,196 KB
testcase_15 AC 133 ms
31,804 KB
testcase_16 AC 133 ms
31,668 KB
testcase_17 AC 132 ms
30,148 KB
testcase_18 AC 131 ms
30,144 KB
testcase_19 AC 132 ms
31,464 KB
testcase_20 AC 137 ms
30,052 KB
testcase_21 AC 141 ms
31,840 KB
testcase_22 AC 135 ms
30,124 KB
testcase_23 AC 132 ms
31,756 KB
testcase_24 AC 132 ms
30,012 KB
testcase_25 AC 132 ms
30,228 KB
testcase_26 AC 134 ms
30,120 KB
testcase_27 AC 134 ms
30,020 KB
testcase_28 AC 134 ms
30,204 KB
testcase_29 AC 132 ms
30,040 KB
testcase_30 AC 131 ms
30,168 KB
testcase_31 AC 132 ms
31,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np


def main():
    a = np.array(list(map(int, input().split())))  # 以下,Aを原点とする
    b = np.array(list(map(int, input().split()))) - a
    c = np.array(list(map(int, input().split()))) - a
    d = np.array(list(map(int, input().split()))) - a

    n = np.cross(b, c)  # 平面ABCの法線ベクトル
    mat = np.matrix([b, c, n]).T  # 基底の変換行列(e1, e2, e3) -> (b, c, n)
    lst = np.dot(np.linalg.inv(mat), d)  # dを基底(b, c, n)で表したときの係数
    x, y = lst[0, 0], lst[0, 1]
    print("YES" if x >= 0 and y >= 0 and x + y <= 1 else "NO")


if __name__ == "__main__":
    main()
0