結果

問題 No.1111 コード進行
ユーザー qumazakiqumazaki
提出日時 2020-07-11 01:17:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 592 ms / 2,000 ms
コード長 839 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 97,880 KB
最終ジャッジ日時 2024-04-20 03:22:43
合計ジャッジ時間 6,211 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,736 KB
testcase_01 AC 39 ms
52,608 KB
testcase_02 AC 39 ms
52,736 KB
testcase_03 AC 40 ms
52,480 KB
testcase_04 AC 42 ms
52,736 KB
testcase_05 AC 44 ms
55,552 KB
testcase_06 AC 61 ms
68,864 KB
testcase_07 AC 64 ms
70,400 KB
testcase_08 AC 61 ms
67,696 KB
testcase_09 AC 54 ms
65,152 KB
testcase_10 AC 58 ms
70,272 KB
testcase_11 AC 54 ms
64,384 KB
testcase_12 AC 60 ms
68,864 KB
testcase_13 AC 54 ms
65,920 KB
testcase_14 AC 72 ms
73,344 KB
testcase_15 AC 55 ms
65,024 KB
testcase_16 AC 60 ms
70,528 KB
testcase_17 AC 52 ms
68,224 KB
testcase_18 AC 44 ms
60,800 KB
testcase_19 AC 39 ms
53,632 KB
testcase_20 AC 53 ms
63,104 KB
testcase_21 AC 44 ms
60,288 KB
testcase_22 AC 56 ms
72,960 KB
testcase_23 AC 54 ms
67,200 KB
testcase_24 AC 53 ms
67,072 KB
testcase_25 AC 75 ms
77,056 KB
testcase_26 AC 60 ms
68,992 KB
testcase_27 AC 49 ms
62,464 KB
testcase_28 AC 88 ms
84,992 KB
testcase_29 AC 77 ms
77,440 KB
testcase_30 AC 108 ms
81,408 KB
testcase_31 AC 66 ms
76,928 KB
testcase_32 AC 146 ms
78,552 KB
testcase_33 AC 154 ms
79,104 KB
testcase_34 AC 77 ms
81,920 KB
testcase_35 AC 84 ms
81,792 KB
testcase_36 AC 274 ms
84,608 KB
testcase_37 AC 124 ms
77,312 KB
testcase_38 AC 106 ms
76,928 KB
testcase_39 AC 209 ms
81,536 KB
testcase_40 AC 234 ms
83,768 KB
testcase_41 AC 119 ms
85,536 KB
testcase_42 AC 157 ms
78,420 KB
testcase_43 AC 162 ms
78,232 KB
testcase_44 AC 87 ms
76,672 KB
testcase_45 AC 114 ms
79,808 KB
testcase_46 AC 68 ms
76,200 KB
testcase_47 AC 592 ms
97,880 KB
testcase_48 AC 61 ms
74,368 KB
testcase_49 AC 69 ms
76,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,m,k = map(int,readline().split())
pqc = list(map(int,read().split()))
mod = 10**9+7

links = [dict() for _ in range(300+1)]
it = iter(pqc)
for p,q,c in zip(it,it,it):
    links[p][q] = c

dp = [0,0]
dp[0] = [[0] * (k+1) for _ in range(300+1)]
dp[1] = [[0] * (k+1) for _ in range(300+1)]
for j in range(1,300+1):
    dp[0][j][0] = 1

for i in range(n-1):
    i %= 2
    i_next = 1-i
    dp[i_next] = [[0] * (k+1) for _ in range(300+1)]
    for j in range(1,301):
        for key,val in links[j].items():
            for l in range(k-val+1):
                dp[i_next][j][l+val] += dp[i][key][l]
                dp[i_next][j][l+val] %= mod

ans = 0
for j in range(1,301):
    ans += dp[i_next][j][k]

ans %= mod
print(ans)
0