結果

問題 No.1111 コード進行
ユーザー stngstng
提出日時 2022-05-22 13:30:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,212 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 296,980 KB
最終ジャッジ日時 2023-10-20 16:58:40
合計ジャッジ時間 9,948 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
59,568 KB
testcase_01 AC 39 ms
59,568 KB
testcase_02 AC 35 ms
53,596 KB
testcase_03 AC 35 ms
53,596 KB
testcase_04 AC 36 ms
53,596 KB
testcase_05 AC 45 ms
64,480 KB
testcase_06 AC 60 ms
70,660 KB
testcase_07 AC 58 ms
68,608 KB
testcase_08 AC 52 ms
66,412 KB
testcase_09 AC 56 ms
68,608 KB
testcase_10 AC 56 ms
70,656 KB
testcase_11 AC 54 ms
68,484 KB
testcase_12 AC 64 ms
70,660 KB
testcase_13 AC 55 ms
68,612 KB
testcase_14 AC 74 ms
72,708 KB
testcase_15 AC 49 ms
64,368 KB
testcase_16 AC 69 ms
72,704 KB
testcase_17 AC 54 ms
70,660 KB
testcase_18 AC 46 ms
62,156 KB
testcase_19 AC 45 ms
61,764 KB
testcase_20 AC 50 ms
66,412 KB
testcase_21 AC 44 ms
61,892 KB
testcase_22 AC 63 ms
73,972 KB
testcase_23 AC 60 ms
70,712 KB
testcase_24 AC 53 ms
68,612 KB
testcase_25 AC 91 ms
84,188 KB
testcase_26 AC 65 ms
70,684 KB
testcase_27 AC 49 ms
64,364 KB
testcase_28 AC 206 ms
182,164 KB
testcase_29 AC 134 ms
113,912 KB
testcase_30 AC 223 ms
148,456 KB
testcase_31 AC 73 ms
88,072 KB
testcase_32 AC 248 ms
135,840 KB
testcase_33 AC 242 ms
112,812 KB
testcase_34 AC 164 ms
154,464 KB
testcase_35 AC 202 ms
159,088 KB
testcase_36 AC 632 ms
184,456 KB
testcase_37 AC 210 ms
101,632 KB
testcase_38 AC 158 ms
94,816 KB
testcase_39 AC 377 ms
147,516 KB
testcase_40 AC 452 ms
174,948 KB
testcase_41 AC 284 ms
197,708 KB
testcase_42 AC 284 ms
124,516 KB
testcase_43 AC 303 ms
118,360 KB
testcase_44 AC 126 ms
91,012 KB
testcase_45 AC 248 ms
149,052 KB
testcase_46 AC 55 ms
66,424 KB
testcase_47 AC 1,212 ms
296,980 KB
testcase_48 AC 52 ms
64,140 KB
testcase_49 AC 51 ms
64,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,K = map(int,input().split())
mod = 10**9+7
pqlen = 301

pqc = [[] for i in range(pqlen)]
for i in range(m):
    p,q,c = map(int,input().split())
    p -= 1
    q -= 1
    pqc[p].append([q,c])

dp = [[[0]*pqlen for i in range(K+1)] for j in range(n+1)]

for i in range(pqlen):
    dp[0][0][i] = 1

for i in range(n-1):
    for j in range(K+1):
        for k in range(pqlen):
            for l in pqc[k]:
                p,c = l
                if j+c <= K:
                    dp[i+1][j+c][p] += dp[i][j][k]
                    dp[i+1][j+c][p] %= mod
#print(dp)
print((sum(dp[n-1][K]))%mod)
0