結果

問題 No.1111 コード進行
ユーザー prd_xxxprd_xxx
提出日時 2020-07-10 22:19:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 973 ms / 2,000 ms
コード長 654 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 295,588 KB
最終ジャッジ日時 2024-04-19 17:31:48
合計ジャッジ時間 8,413 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,728 KB
testcase_01 AC 34 ms
52,224 KB
testcase_02 AC 32 ms
52,096 KB
testcase_03 AC 33 ms
52,352 KB
testcase_04 AC 35 ms
52,608 KB
testcase_05 AC 34 ms
54,272 KB
testcase_06 AC 44 ms
65,280 KB
testcase_07 AC 43 ms
66,432 KB
testcase_08 AC 38 ms
61,056 KB
testcase_09 AC 46 ms
64,768 KB
testcase_10 AC 38 ms
64,768 KB
testcase_11 AC 38 ms
60,032 KB
testcase_12 AC 47 ms
67,840 KB
testcase_13 AC 38 ms
61,056 KB
testcase_14 AC 56 ms
73,344 KB
testcase_15 AC 36 ms
59,520 KB
testcase_16 AC 44 ms
67,456 KB
testcase_17 AC 39 ms
64,896 KB
testcase_18 AC 36 ms
59,392 KB
testcase_19 AC 33 ms
52,864 KB
testcase_20 AC 36 ms
60,032 KB
testcase_21 AC 36 ms
58,240 KB
testcase_22 AC 39 ms
67,200 KB
testcase_23 AC 37 ms
61,056 KB
testcase_24 AC 41 ms
64,256 KB
testcase_25 AC 62 ms
83,968 KB
testcase_26 AC 73 ms
80,128 KB
testcase_27 AC 34 ms
54,400 KB
testcase_28 AC 141 ms
181,376 KB
testcase_29 AC 92 ms
113,024 KB
testcase_30 AC 303 ms
149,632 KB
testcase_31 AC 65 ms
87,936 KB
testcase_32 AC 437 ms
144,128 KB
testcase_33 AC 525 ms
120,832 KB
testcase_34 AC 112 ms
136,576 KB
testcase_35 AC 131 ms
157,824 KB
testcase_36 AC 157 ms
181,120 KB
testcase_37 AC 80 ms
90,112 KB
testcase_38 AC 282 ms
99,968 KB
testcase_39 AC 900 ms
160,256 KB
testcase_40 AC 973 ms
219,392 KB
testcase_41 AC 143 ms
181,120 KB
testcase_42 AC 95 ms
112,896 KB
testcase_43 AC 735 ms
149,504 KB
testcase_44 AC 64 ms
90,368 KB
testcase_45 AC 105 ms
135,680 KB
testcase_46 AC 57 ms
73,344 KB
testcase_47 AC 280 ms
295,588 KB
testcase_48 AC 75 ms
83,328 KB
testcase_49 AC 43 ms
67,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N,M,K = map(int,input().split())
PQC = [tuple(map(int,input().split())) for i in range(M)]
es = [[] for _ in range(300)]
for p,q,c in PQC:
    p,q = p-1,q-1
    es[p].append((q,c))

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

st = set([(i,0) for i in range(300)])
for i in range(N-1):
    st2 = set()
    for p,c in st:
        for np,dc in es[p]:
            if c+dc > K: continue
            dp[i+1][np][c+dc] += dp[i][p][c]
            dp[i+1][np][c+dc] %= MOD
            st2.add((np,c+dc))
    st = st2
print(sum(a[-1] for a in dp[-1]) % MOD)
0