結果

問題 No.1111 コード進行
ユーザー titiatitia
提出日時 2020-07-11 02:20:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 81,984 KB
実行使用メモリ 91,228 KB
最終ジャッジ日時 2024-04-20 05:13:40
合計ジャッジ時間 5,320 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
59,824 KB
testcase_01 AC 35 ms
53,352 KB
testcase_02 AC 33 ms
52,608 KB
testcase_03 AC 34 ms
53,544 KB
testcase_04 AC 34 ms
52,636 KB
testcase_05 AC 40 ms
63,200 KB
testcase_06 AC 49 ms
68,356 KB
testcase_07 AC 51 ms
67,780 KB
testcase_08 AC 51 ms
66,732 KB
testcase_09 AC 51 ms
66,492 KB
testcase_10 AC 52 ms
70,680 KB
testcase_11 AC 48 ms
64,624 KB
testcase_12 AC 53 ms
69,028 KB
testcase_13 AC 49 ms
66,796 KB
testcase_14 AC 61 ms
72,804 KB
testcase_15 AC 45 ms
64,652 KB
testcase_16 AC 55 ms
70,148 KB
testcase_17 AC 47 ms
69,784 KB
testcase_18 AC 40 ms
61,264 KB
testcase_19 AC 39 ms
60,524 KB
testcase_20 AC 44 ms
64,796 KB
testcase_21 AC 39 ms
60,620 KB
testcase_22 AC 49 ms
73,408 KB
testcase_23 AC 49 ms
66,588 KB
testcase_24 AC 46 ms
66,644 KB
testcase_25 AC 57 ms
73,468 KB
testcase_26 AC 52 ms
68,840 KB
testcase_27 AC 49 ms
64,432 KB
testcase_28 AC 74 ms
82,392 KB
testcase_29 AC 67 ms
77,016 KB
testcase_30 AC 88 ms
80,188 KB
testcase_31 AC 57 ms
77,140 KB
testcase_32 AC 131 ms
77,872 KB
testcase_33 AC 128 ms
78,840 KB
testcase_34 AC 67 ms
79,336 KB
testcase_35 AC 76 ms
79,836 KB
testcase_36 AC 196 ms
82,020 KB
testcase_37 AC 113 ms
76,712 KB
testcase_38 AC 99 ms
76,584 KB
testcase_39 AC 145 ms
80,496 KB
testcase_40 AC 172 ms
81,492 KB
testcase_41 AC 85 ms
82,728 KB
testcase_42 AC 144 ms
78,016 KB
testcase_43 AC 153 ms
78,152 KB
testcase_44 AC 71 ms
77,012 KB
testcase_45 AC 97 ms
78,856 KB
testcase_46 AC 103 ms
75,972 KB
testcase_47 AC 312 ms
91,228 KB
testcase_48 AC 84 ms
76,212 KB
testcase_49 AC 93 ms
76,128 KB
権限があれば一括ダウンロードができます

ソースコード

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