結果

問題 No.1111 コード進行
ユーザー uni_pythonuni_python
提出日時 2020-07-11 16:04:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 958 ms / 2,000 ms
コード長 874 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,104 KB
実行使用メモリ 295,296 KB
最終ジャッジ日時 2024-04-21 05:42:56
合計ジャッジ時間 7,588 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
57,856 KB
testcase_01 AC 37 ms
52,224 KB
testcase_02 AC 36 ms
52,224 KB
testcase_03 AC 37 ms
52,224 KB
testcase_04 AC 37 ms
52,224 KB
testcase_05 AC 40 ms
54,656 KB
testcase_06 AC 55 ms
65,280 KB
testcase_07 AC 62 ms
67,712 KB
testcase_08 AC 52 ms
64,000 KB
testcase_09 AC 50 ms
62,976 KB
testcase_10 AC 57 ms
67,200 KB
testcase_11 AC 52 ms
62,720 KB
testcase_12 AC 59 ms
66,048 KB
testcase_13 AC 51 ms
63,488 KB
testcase_14 AC 65 ms
69,248 KB
testcase_15 AC 49 ms
61,824 KB
testcase_16 AC 58 ms
66,816 KB
testcase_17 AC 51 ms
66,432 KB
testcase_18 AC 42 ms
59,392 KB
testcase_19 AC 37 ms
53,248 KB
testcase_20 AC 46 ms
61,056 KB
testcase_21 AC 43 ms
59,136 KB
testcase_22 AC 56 ms
69,248 KB
testcase_23 AC 55 ms
63,872 KB
testcase_24 AC 53 ms
64,128 KB
testcase_25 AC 71 ms
72,576 KB
testcase_26 AC 60 ms
65,408 KB
testcase_27 AC 47 ms
61,184 KB
testcase_28 AC 179 ms
181,760 KB
testcase_29 AC 115 ms
113,220 KB
testcase_30 AC 165 ms
136,704 KB
testcase_31 AC 51 ms
72,320 KB
testcase_32 AC 229 ms
135,680 KB
testcase_33 AC 220 ms
113,792 KB
testcase_34 AC 126 ms
136,704 KB
testcase_35 AC 177 ms
179,568 KB
testcase_36 AC 421 ms
181,632 KB
testcase_37 AC 150 ms
90,740 KB
testcase_38 AC 187 ms
97,280 KB
testcase_39 AC 303 ms
136,548 KB
testcase_40 AC 337 ms
159,360 KB
testcase_41 AC 197 ms
182,272 KB
testcase_42 AC 218 ms
113,536 KB
testcase_43 AC 224 ms
113,792 KB
testcase_44 AC 106 ms
90,864 KB
testcase_45 AC 189 ms
136,320 KB
testcase_46 AC 79 ms
83,200 KB
testcase_47 AC 958 ms
295,296 KB
testcase_48 AC 81 ms
82,784 KB
testcase_49 AC 89 ms
82,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M,K=MI()
    MM=300
    dp=[[[0]*(K+1) for _ in range(MM)]for _ in range(N)]
    #i個使った,j番目にいる,合計k
    
    for j in range(MM):
        dp[0][j][0]=1
    
    
    pqc=[]
    for i in range(M):
        p,q,c=MI()
        p-=1
        q-=1
        pqc.append((p,q,c))
        
    for i in range(N-1):
        for jj in range(M):
            fro=pqc[jj][0]
            to=pqc[jj][1]
            cost=pqc[jj][2]
            for k in range(K+1-cost):
                dp[i+1][to][k+cost]=(dp[i+1][to][k+cost] + dp[i][fro][k])%mod
                
    ans=0
    for j in range(MM):
        ans=(ans + dp[-1][j][-1])%mod
        
    print(ans)
        


main()
0