結果

問題 No.2444 一次変換と体積
ユーザー 👑 KazunKazun
提出日時 2022-12-30 20:08:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 71,452 KB
最終ジャッジ日時 2023-08-25 20:50:07
合計ジャッジ時間 2,825 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,440 KB
testcase_01 AC 69 ms
71,300 KB
testcase_02 AC 70 ms
71,388 KB
testcase_03 AC 70 ms
71,452 KB
testcase_04 AC 70 ms
70,996 KB
testcase_05 AC 70 ms
71,296 KB
testcase_06 AC 70 ms
71,340 KB
testcase_07 AC 69 ms
71,304 KB
testcase_08 AC 70 ms
71,340 KB
testcase_09 AC 69 ms
71,320 KB
testcase_10 AC 70 ms
71,388 KB
testcase_11 AC 69 ms
71,348 KB
testcase_12 AC 69 ms
71,368 KB
testcase_13 AC 69 ms
71,388 KB
testcase_14 AC 70 ms
71,232 KB
testcase_15 AC 70 ms
71,360 KB
testcase_16 AC 70 ms
71,336 KB
testcase_17 AC 70 ms
71,384 KB
testcase_18 AC 70 ms
71,212 KB
testcase_19 AC 68 ms
71,132 KB
権限があれば一括ダウンロードができます

ソースコード

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