結果

問題 No.622 点と三角柱の内外判定
ユーザー mitsuomitsuo
提出日時 2018-01-07 16:13:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,155 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 8,240 KB
最終ジャッジ日時 2023-08-24 23:26:12
合計ジャッジ時間 1,972 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 18 ms
8,156 KB
testcase_02 AC 17 ms
8,240 KB
testcase_03 AC 16 ms
8,052 KB
testcase_04 WA -
testcase_05 AC 16 ms
8,112 KB
testcase_06 WA -
testcase_07 AC 16 ms
8,124 KB
testcase_08 AC 16 ms
8,084 KB
testcase_09 AC 16 ms
8,140 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 17 ms
8,196 KB
testcase_13 AC 16 ms
8,080 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 16 ms
8,088 KB
testcase_17 WA -
testcase_18 AC 16 ms
8,144 KB
testcase_19 AC 17 ms
8,048 KB
testcase_20 AC 16 ms
8,092 KB
testcase_21 AC 16 ms
8,184 KB
testcase_22 AC 16 ms
8,200 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 16 ms
8,200 KB
testcase_27 AC 16 ms
8,196 KB
testcase_28 AC 17 ms
8,060 KB
testcase_29 WA -
testcase_30 AC 16 ms
8,104 KB
testcase_31 AC 16 ms
8,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def cp(AB, AC):
    return [AB[1] * AC[2] - AB[2] * AC[1],
          AB[2] * AC[0] - AB[0] * AC[2],
          AB[0] * AC[1] - AB[1] * AC[0]]

def dp(A, B):
    return sum([A[i] * B[i] for i in range(0,3)])


def solve(A, B, C, D):
    AB = [B[i] - A[i] for i in range(0,3)]
    AC = [C[i] - A[i] for i in range(0,3)]
    N  = cp(AB,  AC)

    d = -(sum(N[i] * A[i] for i in range(0,3)))

    k = (sum(N[i] * D[i] for i in range(0,3))) / (sum(N[i] * N[i] for i in range(0,3)))
    H = [k * N[i] for i in range(0,3)]

    AB = [B[i] - A[i] for i in range(0,3)]
    BH = [H[i] - B[i] for i in range(0,3)]

    BC = [C[i] - B[i] for i in range(0,3)]
    CH = [H[i] - C[i] for i in range(0,3)]

    CA = [A[i] - C[i] for i in range(0,3)]
    AH = [H[i] - A[i] for i in range(0,3)]

    c1 = cp(CA, AH)
    c2 = cp(AB, BH)
    c3 = cp(BC, CH)

    a = dp(c1, c2)
    b = dp(c1, c3)

    return True if (a * b > 0) else False

if __name__ == '__main__':
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    D = list(map(int, input().split()))
    print("YES" if solve(A, B, C, D) else "NO")
0