結果

問題 No.1112 冥界の音楽
ユーザー qumazakiqumazaki
提出日時 2020-07-11 01:58:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 796 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 44,640 KB
最終ジャッジ日時 2024-04-20 04:13:45
合計ジャッジ時間 20,097 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 479 ms
44,252 KB
testcase_01 AC 475 ms
44,376 KB
testcase_02 AC 466 ms
43,868 KB
testcase_03 AC 475 ms
43,996 KB
testcase_04 AC 471 ms
44,376 KB
testcase_05 AC 475 ms
44,636 KB
testcase_06 AC 464 ms
44,248 KB
testcase_07 AC 483 ms
44,000 KB
testcase_08 AC 470 ms
44,004 KB
testcase_09 AC 470 ms
44,252 KB
testcase_10 AC 475 ms
44,636 KB
testcase_11 AC 478 ms
44,380 KB
testcase_12 AC 464 ms
44,508 KB
testcase_13 AC 479 ms
43,996 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 468 ms
44,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 483 ms
43,996 KB
testcase_20 AC 471 ms
43,996 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 469 ms
44,252 KB
testcase_25 AC 473 ms
44,264 KB
testcase_26 AC 470 ms
44,248 KB
testcase_27 AC 471 ms
43,968 KB
testcase_28 AC 472 ms
44,380 KB
testcase_29 AC 477 ms
44,632 KB
testcase_30 WA -
testcase_31 AC 472 ms
44,376 KB
testcase_32 WA -
testcase_33 AC 488 ms
44,256 KB
testcase_34 AC 473 ms
44,004 KB
testcase_35 AC 472 ms
43,992 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.intp)
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.intp)
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