結果

問題 No.1111 コード進行
ユーザー ああいいああいい
提出日時 2022-05-15 09:49:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 456 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 1,076 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 92,428 KB
最終ジャッジ日時 2023-10-01 04:29:11
合計ジャッジ時間 10,025 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
76,040 KB
testcase_01 AC 75 ms
76,292 KB
testcase_02 AC 72 ms
71,192 KB
testcase_03 AC 71 ms
71,492 KB
testcase_04 AC 70 ms
71,348 KB
testcase_05 AC 77 ms
76,172 KB
testcase_06 AC 91 ms
76,652 KB
testcase_07 AC 95 ms
76,640 KB
testcase_08 AC 93 ms
76,472 KB
testcase_09 AC 87 ms
76,664 KB
testcase_10 AC 93 ms
76,548 KB
testcase_11 AC 86 ms
76,616 KB
testcase_12 AC 94 ms
76,268 KB
testcase_13 AC 87 ms
76,588 KB
testcase_14 AC 101 ms
79,376 KB
testcase_15 AC 86 ms
76,656 KB
testcase_16 AC 97 ms
76,456 KB
testcase_17 AC 88 ms
76,256 KB
testcase_18 AC 82 ms
76,232 KB
testcase_19 AC 73 ms
71,072 KB
testcase_20 AC 85 ms
76,592 KB
testcase_21 AC 81 ms
76,612 KB
testcase_22 AC 92 ms
76,624 KB
testcase_23 AC 88 ms
76,572 KB
testcase_24 AC 88 ms
76,536 KB
testcase_25 AC 103 ms
78,632 KB
testcase_26 AC 92 ms
76,384 KB
testcase_27 AC 79 ms
76,420 KB
testcase_28 AC 183 ms
83,004 KB
testcase_29 AC 130 ms
78,468 KB
testcase_30 AC 166 ms
81,856 KB
testcase_31 AC 98 ms
78,604 KB
testcase_32 AC 179 ms
79,444 KB
testcase_33 AC 159 ms
80,340 KB
testcase_34 AC 157 ms
81,368 KB
testcase_35 AC 182 ms
81,280 KB
testcase_36 AC 256 ms
84,200 KB
testcase_37 AC 140 ms
77,756 KB
testcase_38 AC 129 ms
77,912 KB
testcase_39 AC 204 ms
81,892 KB
testcase_40 AC 240 ms
82,856 KB
testcase_41 AC 206 ms
85,124 KB
testcase_42 AC 165 ms
78,876 KB
testcase_43 AC 164 ms
78,820 KB
testcase_44 AC 115 ms
77,916 KB
testcase_45 AC 172 ms
80,848 KB
testcase_46 AC 92 ms
76,596 KB
testcase_47 AC 456 ms
92,428 KB
testcase_48 AC 92 ms
76,304 KB
testcase_49 AC 95 ms
77,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K = map(int,input().split())

edge = []
for _ in range(M):
    p,q,c = map(int,input().split())
    edge.append((p,q,c))
mod = 10 ** 9 + 7
C = 301
dp = [[0] * (K + 1) for _ in range(C)]
for p,q,c in edge:
    if c <= K:
        dp[q][c] += 1
for _ in range(N - 2):
    nx = [[0] * (K + 1) for _ in range(C)]
    for p,q,c in edge:
        for i in range(K - c + 1):
            nx[q][i + c] += dp[p][i]
    for p in range(C):
        for i in range(K + 1):
            nx[p][i] %= mod
    dp = nx
ans = 0
for p in range(C):
    ans += dp[p][-1]
print(ans%mod)
0