結果

問題 No.1111 コード進行
ユーザー 👑 rin204rin204
提出日時 2022-07-04 16:02:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 920 ms / 2,000 ms
コード長 681 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 159,948 KB
最終ジャッジ日時 2023-08-20 23:43:10
合計ジャッジ時間 10,965 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,308 KB
testcase_01 AC 78 ms
76,308 KB
testcase_02 AC 76 ms
71,064 KB
testcase_03 AC 74 ms
71,316 KB
testcase_04 AC 73 ms
71,200 KB
testcase_05 AC 88 ms
76,456 KB
testcase_06 AC 106 ms
79,612 KB
testcase_07 AC 105 ms
78,632 KB
testcase_08 AC 97 ms
76,764 KB
testcase_09 AC 103 ms
79,912 KB
testcase_10 AC 105 ms
79,084 KB
testcase_11 AC 94 ms
76,780 KB
testcase_12 AC 109 ms
79,276 KB
testcase_13 AC 107 ms
79,220 KB
testcase_14 AC 125 ms
80,712 KB
testcase_15 AC 95 ms
76,584 KB
testcase_16 AC 108 ms
79,588 KB
testcase_17 AC 100 ms
79,212 KB
testcase_18 AC 88 ms
76,576 KB
testcase_19 AC 82 ms
76,508 KB
testcase_20 AC 94 ms
76,856 KB
testcase_21 AC 83 ms
76,520 KB
testcase_22 AC 111 ms
79,904 KB
testcase_23 AC 101 ms
78,388 KB
testcase_24 AC 102 ms
79,016 KB
testcase_25 AC 117 ms
79,348 KB
testcase_26 AC 108 ms
78,612 KB
testcase_27 AC 95 ms
76,732 KB
testcase_28 AC 195 ms
95,344 KB
testcase_29 AC 148 ms
81,712 KB
testcase_30 AC 191 ms
91,248 KB
testcase_31 AC 106 ms
79,620 KB
testcase_32 AC 214 ms
83,788 KB
testcase_33 AC 262 ms
90,452 KB
testcase_34 AC 162 ms
89,284 KB
testcase_35 AC 191 ms
89,340 KB
testcase_36 AC 452 ms
103,068 KB
testcase_37 AC 199 ms
79,904 KB
testcase_38 AC 174 ms
79,732 KB
testcase_39 AC 281 ms
93,364 KB
testcase_40 AC 351 ms
97,052 KB
testcase_41 AC 245 ms
98,284 KB
testcase_42 AC 259 ms
83,164 KB
testcase_43 AC 268 ms
87,080 KB
testcase_44 AC 142 ms
80,060 KB
testcase_45 AC 225 ms
89,464 KB
testcase_46 AC 102 ms
77,516 KB
testcase_47 AC 920 ms
159,948 KB
testcase_48 AC 97 ms
77,320 KB
testcase_49 AC 101 ms
77,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7

n, m, k = map(int, input().split())
edges = [[] for _ in range(300)]
for _ in range(m):
    u, v, c = map(int, input().split())
    u -= 1
    v -= 1
    edges[u].append((v, c))

cnt = [[0] * (k + 1) for _ in range(300)]
for i in range(300):
    cnt[i][0] = 1

for _ in range(n - 1):
    cnt2 = [[0] * (k + 1) for _ in range(300)]
    for i in range(300):
        for j in range(k + 1):
            for l, c in edges[i]:
                if j + c <= k:
                    cnt2[l][j + c] += cnt[i][j]
                    cnt2[l][j + c] %= MOD
    cnt = [row[:] for row in cnt2]
ans = 0
for i in range(300):
    ans += cnt[i][-1]
    ans %= MOD
print(ans)
        
0