結果

問題 No.1112 冥界の音楽
ユーザー qumazakiqumazaki
提出日時 2020-07-11 01:53:14
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 798 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 30,180 KB
最終ジャッジ日時 2023-08-02 04:41:36
合計ジャッジ時間 9,698 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
30,064 KB
testcase_01 AC 137 ms
30,036 KB
testcase_02 AC 137 ms
30,044 KB
testcase_03 AC 138 ms
29,936 KB
testcase_04 AC 139 ms
30,028 KB
testcase_05 AC 144 ms
30,072 KB
testcase_06 AC 148 ms
29,936 KB
testcase_07 AC 141 ms
29,984 KB
testcase_08 AC 143 ms
30,016 KB
testcase_09 AC 145 ms
30,036 KB
testcase_10 AC 141 ms
30,148 KB
testcase_11 AC 143 ms
30,096 KB
testcase_12 AC 143 ms
30,024 KB
testcase_13 AC 142 ms
29,908 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 148 ms
29,968 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 143 ms
30,040 KB
testcase_20 AC 141 ms
30,012 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 146 ms
30,028 KB
testcase_25 AC 143 ms
30,048 KB
testcase_26 AC 141 ms
30,108 KB
testcase_27 AC 143 ms
30,128 KB
testcase_28 AC 145 ms
30,108 KB
testcase_29 AC 140 ms
30,056 KB
testcase_30 WA -
testcase_31 AC 137 ms
30,068 KB
testcase_32 WA -
testcase_33 AC 138 ms
30,084 KB
testcase_34 AC 142 ms
30,036 KB
testcase_35 AC 145 ms
30,044 KB
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

k,m,n = map(int,readline().split())
pqr = list(map(int,read().split()))
mod = 10**9+7

mat = np.zeros((36,36), dtype=np.int64)
it = iter(pqr)
for p,q,r in zip(it,it,it):
    p,q,r = p-1,q-1,r-1
    mat[(p*6+q),(q*6+r)] = 1

def dot_mod(a,b):
    res = np.dot(a,b)
    res %= mod
    return res

mat_ex = [mat]
for i in range(65):
    mat_ex.append( dot_mod(mat_ex[-1],mat_ex[-1]) )

mat_n = np.zeros((36,36), dtype=np.int64)
for i in range(36):
    mat_n[i,i] = 1

x = n-2
for i in range(65):
    if((x>>i)&1):
        mat_n = dot_mod(mat_n,mat_ex[i])

ans = 0
for i in range(6):
    for j in range(6):
        ans += mat_n[i][6*j]
        ans %= mod

print(ans)
0