結果

問題 No.1111 コード進行
ユーザー tanon710tanon710
提出日時 2020-07-10 22:39:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 675 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 296,468 KB
最終ジャッジ日時 2024-04-19 17:53:04
合計ジャッジ時間 6,048 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
58,212 KB
testcase_01 AC 34 ms
52,884 KB
testcase_02 AC 34 ms
52,872 KB
testcase_03 AC 35 ms
53,100 KB
testcase_04 AC 35 ms
52,432 KB
testcase_05 AC 36 ms
55,232 KB
testcase_06 AC 46 ms
66,704 KB
testcase_07 AC 49 ms
68,180 KB
testcase_08 AC 46 ms
65,252 KB
testcase_09 AC 43 ms
64,656 KB
testcase_10 AC 43 ms
68,720 KB
testcase_11 AC 46 ms
63,956 KB
testcase_12 AC 45 ms
66,764 KB
testcase_13 AC 44 ms
65,140 KB
testcase_14 AC 53 ms
70,092 KB
testcase_15 AC 43 ms
63,772 KB
testcase_16 AC 48 ms
67,176 KB
testcase_17 AC 42 ms
67,996 KB
testcase_18 AC 37 ms
60,668 KB
testcase_19 AC 36 ms
54,580 KB
testcase_20 AC 43 ms
61,820 KB
testcase_21 AC 38 ms
59,932 KB
testcase_22 AC 44 ms
70,256 KB
testcase_23 AC 44 ms
65,484 KB
testcase_24 AC 42 ms
66,112 KB
testcase_25 AC 55 ms
74,200 KB
testcase_26 AC 48 ms
66,100 KB
testcase_27 AC 40 ms
61,620 KB
testcase_28 AC 147 ms
182,128 KB
testcase_29 AC 94 ms
113,348 KB
testcase_30 AC 137 ms
136,904 KB
testcase_31 AC 47 ms
73,368 KB
testcase_32 AC 167 ms
135,900 KB
testcase_33 AC 157 ms
114,016 KB
testcase_34 AC 109 ms
137,164 KB
testcase_35 AC 157 ms
180,464 KB
testcase_36 AC 312 ms
181,904 KB
testcase_37 AC 114 ms
90,740 KB
testcase_38 AC 104 ms
90,728 KB
testcase_39 AC 223 ms
136,644 KB
testcase_40 AC 261 ms
159,556 KB
testcase_41 AC 167 ms
182,656 KB
testcase_42 AC 175 ms
113,156 KB
testcase_43 AC 169 ms
113,828 KB
testcase_44 AC 83 ms
91,432 KB
testcase_45 AC 143 ms
136,872 KB
testcase_46 AC 50 ms
70,252 KB
testcase_47 AC 675 ms
296,468 KB
testcase_48 AC 49 ms
70,780 KB
testcase_49 AC 55 ms
70,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import sys
input=sys.stdin.readline

mod=10**9+7
N,M,K=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(M)]
dp=[[[0]*(K+1) for _ in range(301)] for _ in range(N)]
for i in range(301):
    dp[0][i][0]=1
for i in range(N-1):
    for j in range(M):
        p,q,c=arr[j]
        for k in range(K-c,-1,-1):
            dp[i+1][q][k+c]+=dp[i][p][k]
            dp[i+1][q][k+c]%=mod
ans=0
for i in range(301):
    ans+=dp[N-1][i][K]
    ans%=mod
print(ans)
0