結果

問題 No.1112 冥界の音楽
ユーザー tikitaka1201tikitaka1201
提出日時 2020-07-12 15:04:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 431 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 50,896 KB
最終ジャッジ日時 2024-04-23 04:04:27
合計ジャッジ時間 11,464 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 439 ms
50,896 KB
testcase_01 AC 434 ms
43,956 KB
testcase_02 AC 432 ms
44,348 KB
testcase_03 AC 436 ms
44,316 KB
testcase_04 AC 433 ms
43,960 KB
testcase_05 AC 438 ms
44,216 KB
testcase_06 AC 437 ms
44,212 KB
testcase_07 AC 435 ms
43,960 KB
testcase_08 AC 433 ms
44,088 KB
testcase_09 AC 437 ms
44,216 KB
testcase_10 AC 438 ms
44,596 KB
testcase_11 AC 434 ms
43,960 KB
testcase_12 AC 435 ms
44,216 KB
testcase_13 AC 447 ms
43,960 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

k,m,n = map(int, input().split())
mod = 10**9+7
A = [[0]*(k**2) for _ in range(k**2)]

for _ in range(m):
    p,q,r = map(int, input().split())
    s = (p-1)*k+q-1
    t = (q-1)*k+r-1
    A[s][t] = 1

A=np.array(A)
B=np.eye(A.shape[0],A.shape[1], dtype=int)

for _ in range(n-2):
    B = np.dot(B,A)
    B%=mod
ans = 0
for i in range(k):
    for j in range(k):
        ans+=B[i][j*k]
        ans%=mod
print(ans)
0