結果

問題 No.1111 コード進行
ユーザー convexineqconvexineq
提出日時 2021-05-11 02:17:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 1,274 ms
コンパイル使用メモリ 81,624 KB
実行使用メモリ 90,424 KB
最終ジャッジ日時 2023-10-21 07:00:26
合計ジャッジ時間 5,815 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
59,748 KB
testcase_01 AC 42 ms
59,756 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 35 ms
53,460 KB
testcase_05 AC 42 ms
61,820 KB
testcase_06 AC 50 ms
68,384 KB
testcase_07 AC 58 ms
68,480 KB
testcase_08 AC 47 ms
64,196 KB
testcase_09 AC 52 ms
66,292 KB
testcase_10 AC 48 ms
68,292 KB
testcase_11 AC 47 ms
64,196 KB
testcase_12 AC 57 ms
70,528 KB
testcase_13 AC 48 ms
64,196 KB
testcase_14 AC 59 ms
72,572 KB
testcase_15 AC 45 ms
62,148 KB
testcase_16 AC 53 ms
70,528 KB
testcase_17 AC 47 ms
68,292 KB
testcase_18 AC 44 ms
62,148 KB
testcase_19 AC 40 ms
59,748 KB
testcase_20 AC 44 ms
63,868 KB
testcase_21 AC 46 ms
61,932 KB
testcase_22 AC 50 ms
70,340 KB
testcase_23 AC 47 ms
64,196 KB
testcase_24 AC 50 ms
66,340 KB
testcase_25 AC 60 ms
73,816 KB
testcase_26 AC 58 ms
70,536 KB
testcase_27 AC 46 ms
61,820 KB
testcase_28 AC 97 ms
81,568 KB
testcase_29 AC 79 ms
76,772 KB
testcase_30 AC 117 ms
80,836 KB
testcase_31 AC 65 ms
76,796 KB
testcase_32 AC 134 ms
78,308 KB
testcase_33 AC 138 ms
77,960 KB
testcase_34 AC 93 ms
79,764 KB
testcase_35 AC 96 ms
79,516 KB
testcase_36 AC 105 ms
81,880 KB
testcase_37 AC 74 ms
76,420 KB
testcase_38 AC 101 ms
76,592 KB
testcase_39 AC 176 ms
80,840 KB
testcase_40 AC 204 ms
83,088 KB
testcase_41 AC 105 ms
81,340 KB
testcase_42 AC 79 ms
76,844 KB
testcase_43 AC 143 ms
79,000 KB
testcase_44 AC 63 ms
76,080 KB
testcase_45 AC 83 ms
77,944 KB
testcase_46 AC 59 ms
72,636 KB
testcase_47 AC 157 ms
90,424 KB
testcase_48 AC 57 ms
72,640 KB
testcase_49 AC 57 ms
72,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = 300
n,m,k = map(int,input().split())
g = [[] for _ in range(N)]
for _ in range(m):
    p,q,c = map(int,input().split())
    g[p-1].append((q-1,c))

MOD = 10**9+7
dp = [[0]*(k+1) for _ in range(N)]
for i in range(N):
    dp[i][0] = 1

for _ in range(n-1):
    ndp = [[0]*(k+1) for _ in range(N)]
    for i in range(N):
        for j,v in enumerate(dp[i]):
            if v==0: continue
            for q,c in g[i]:
                if j+c > k: continue
                ndp[q][j+c] += v
                ndp[q][j+c] %= MOD
    dp = ndp

ans = 0
for i in range(N):
    ans += dp[i][-1]
print(ans%MOD)
0