結果

問題 No.2444 一次変換と体積
ユーザー 👑 Kazun
提出日時 2022-12-30 20:08:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-12-24 07:03:05
合計ジャッジ時間 1,871 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    from itertools import permutations

    N,B=map(int,input().split())
    A=[None]*3

    for i in range(3):
        A[i]=list(map(int,input().split()))

    def sgn(P):
        k=0
        for i in range(len(P)):
            for j in range(i):
                if P[j]>P[i]:
                    k+=1
        return -1 if k%2 else 1

    def det(A):
        d=0
        for P in permutations(range(3)):
            P0,P1,P2=P
            d+=sgn(P)*A[0][P0]*A[1][P1]*A[2][P2]
        return d

    return pow(abs(det(A)), N, B)

#==================================================
print(solve())
0