結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
59,292 KB
testcase_01 AC 35 ms
57,912 KB
testcase_02 AC 35 ms
53,416 KB
testcase_03 AC 35 ms
53,668 KB
testcase_04 AC 35 ms
53,620 KB
testcase_05 AC 36 ms
63,204 KB
testcase_06 AC 44 ms
67,460 KB
testcase_07 AC 48 ms
68,976 KB
testcase_08 AC 45 ms
65,664 KB
testcase_09 AC 44 ms
66,904 KB
testcase_10 AC 48 ms
69,740 KB
testcase_11 AC 42 ms
65,388 KB
testcase_12 AC 45 ms
68,168 KB
testcase_13 AC 41 ms
64,584 KB
testcase_14 AC 52 ms
72,784 KB
testcase_15 AC 43 ms
63,640 KB
testcase_16 AC 46 ms
68,168 KB
testcase_17 AC 41 ms
67,988 KB
testcase_18 AC 36 ms
59,936 KB
testcase_19 AC 34 ms
53,948 KB
testcase_20 AC 39 ms
63,060 KB
testcase_21 AC 37 ms
59,836 KB
testcase_22 AC 43 ms
70,604 KB
testcase_23 AC 43 ms
65,360 KB
testcase_24 AC 42 ms
65,400 KB
testcase_25 AC 54 ms
74,396 KB
testcase_26 AC 50 ms
68,624 KB
testcase_27 AC 43 ms
65,220 KB
testcase_28 AC 148 ms
182,116 KB
testcase_29 AC 94 ms
113,708 KB
testcase_30 AC 139 ms
137,052 KB
testcase_31 AC 45 ms
74,208 KB
testcase_32 AC 167 ms
135,568 KB
testcase_33 AC 160 ms
113,748 KB
testcase_34 AC 125 ms
156,508 KB
testcase_35 AC 152 ms
181,072 KB
testcase_36 AC 314 ms
181,712 KB
testcase_37 AC 115 ms
90,496 KB
testcase_38 AC 129 ms
90,556 KB
testcase_39 AC 223 ms
136,520 KB
testcase_40 AC 257 ms
159,348 KB
testcase_41 AC 177 ms
182,556 KB
testcase_42 AC 164 ms
113,108 KB
testcase_43 AC 169 ms
113,740 KB
testcase_44 AC 81 ms
91,336 KB
testcase_45 AC 147 ms
136,664 KB
testcase_46 AC 50 ms
72,316 KB
testcase_47 AC 694 ms
297,284 KB
testcase_48 AC 52 ms
72,004 KB
testcase_49 AC 54 ms
71,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import sys
input=sys.stdin.readline

mod=10**9+7
N,M,K=map(int,input().split())
edges=[[] for _ in range(301)]
s=set()
for _ in range(M):
    p,q,c=map(int,input().split())
    edges[p].append((q,c))
    s.add(p)
dp=[[[0]*(K+1) for _ in range(301)] for _ in range(N+1)]
for i in range(301):
    if i not in s:
        dp[1][i][0]=0
    else:
        dp[1][i][0]=1
for i in range(1,N):
    for j in s:
        for q,c in edges[j]:
            for k in range(K-c,-1,-1):
                dp[i+1][q][k+c]+=dp[i][j][k]
                dp[i+1][q][k+c]%=mod
ans=0
for i in range(301):
    ans+=dp[N][i][K]
    ans%=mod
print(ans)
0