結果

問題 No.1111 コード進行
ユーザー titia
提出日時 2020-07-11 02:20:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 542 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 17,700 KB
最終ジャッジ日時 2024-10-12 00:12:59
合計ジャッジ時間 14,038 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32 TLE * 3 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

mod=10**9+7

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

E=[tuple(map(int,input().split())) for i in range(M)]

DP=dict()
DP=[[0]*(K+1) for i in range(301)]
for i in range(1,301):
    DP[i][0]=1

for i in range(N-1):
    NDP=[[0]*(K+1) for i in range(301)]

    for fr,to,cost in E:
        for j in range(301):
            if j+cost<=K:
                NDP[to][j+cost]+=DP[fr][j]
                NDP[to][j+cost]%=mod

    DP=NDP
                    
ANS=0
for i in range(301):
    ANS=(ANS+DP[i][K])%mod
print(ANS)
0