結果

問題 No.1111 コード進行
ユーザー lloyzlloyz
提出日時 2022-04-22 00:26:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 640 ms / 2,000 ms
コード長 713 bytes
コンパイル時間 1,294 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 297,052 KB
最終ジャッジ日時 2023-09-05 06:52:50
合計ジャッジ時間 12,953 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
76,444 KB
testcase_01 AC 83 ms
76,456 KB
testcase_02 AC 75 ms
71,044 KB
testcase_03 AC 75 ms
71,436 KB
testcase_04 AC 76 ms
71,368 KB
testcase_05 AC 87 ms
76,468 KB
testcase_06 AC 99 ms
76,640 KB
testcase_07 AC 101 ms
76,744 KB
testcase_08 AC 90 ms
76,596 KB
testcase_09 AC 96 ms
76,556 KB
testcase_10 AC 96 ms
76,364 KB
testcase_11 AC 89 ms
76,352 KB
testcase_12 AC 101 ms
76,568 KB
testcase_13 AC 92 ms
76,172 KB
testcase_14 AC 117 ms
84,128 KB
testcase_15 AC 86 ms
76,540 KB
testcase_16 AC 107 ms
82,408 KB
testcase_17 AC 95 ms
76,712 KB
testcase_18 AC 87 ms
76,432 KB
testcase_19 AC 84 ms
76,672 KB
testcase_20 AC 87 ms
76,308 KB
testcase_21 AC 87 ms
76,344 KB
testcase_22 AC 109 ms
85,768 KB
testcase_23 AC 88 ms
76,588 KB
testcase_24 AC 92 ms
76,712 KB
testcase_25 AC 119 ms
85,356 KB
testcase_26 AC 112 ms
81,840 KB
testcase_27 AC 86 ms
76,384 KB
testcase_28 AC 346 ms
176,476 KB
testcase_29 AC 213 ms
124,676 KB
testcase_30 AC 313 ms
149,596 KB
testcase_31 AC 122 ms
86,740 KB
testcase_32 AC 350 ms
143,124 KB
testcase_33 AC 305 ms
119,416 KB
testcase_34 AC 293 ms
156,556 KB
testcase_35 AC 350 ms
181,368 KB
testcase_36 AC 348 ms
175,568 KB
testcase_37 AC 175 ms
106,184 KB
testcase_38 AC 207 ms
98,520 KB
testcase_39 AC 437 ms
148,576 KB
testcase_40 AC 521 ms
177,680 KB
testcase_41 AC 382 ms
193,816 KB
testcase_42 AC 232 ms
127,516 KB
testcase_43 AC 337 ms
121,352 KB
testcase_44 AC 146 ms
97,456 KB
testcase_45 AC 282 ms
151,864 KB
testcase_46 AC 125 ms
84,316 KB
testcase_47 AC 640 ms
297,052 KB
testcase_48 AC 124 ms
84,136 KB
testcase_49 AC 120 ms
83,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, k = map(int, input().split())
Edge = [[] for _ in range(300)]
for _ in range(m):
    p, q, c = map(int, input().split())
    p -= 1
    q -= 1
    Edge[p].append((q, c))
mod = 10**9 + 7

DP = [[[0 for _ in range(k + 1)] for _ in range(300)] for _ in range(n)]
for i in range(300):
    DP[0][i][0] = 1
for i in range(n - 1):
    for j in range(300):
        for c in range(k + 1):
            if DP[i][j][c] > 0:
                for nj, nc in Edge[j]:
                    if c + nc > k:
                        continue
                    DP[i + 1][nj][c + nc] += DP[i][j][c]
                    DP[i + 1][nj][c + nc] %= mod
ans = 0
for i in range(300):
    ans += DP[n - 1][i][k]
    ans %= mod
print(ans)
0