結果

問題 No.1111 コード進行
ユーザー O2MTO2MT
提出日時 2021-06-09 16:30:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 891 ms / 2,000 ms
コード長 490 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 296,784 KB
最終ジャッジ日時 2023-08-18 22:22:42
合計ジャッジ時間 11,660 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
76,128 KB
testcase_01 AC 76 ms
75,356 KB
testcase_02 AC 77 ms
71,128 KB
testcase_03 AC 73 ms
71,456 KB
testcase_04 AC 73 ms
71,444 KB
testcase_05 AC 80 ms
75,244 KB
testcase_06 AC 96 ms
76,720 KB
testcase_07 AC 96 ms
76,440 KB
testcase_08 AC 92 ms
76,888 KB
testcase_09 AC 88 ms
76,616 KB
testcase_10 AC 89 ms
76,400 KB
testcase_11 AC 88 ms
76,844 KB
testcase_12 AC 91 ms
76,820 KB
testcase_13 AC 89 ms
76,616 KB
testcase_14 AC 106 ms
84,092 KB
testcase_15 AC 85 ms
76,660 KB
testcase_16 AC 97 ms
76,616 KB
testcase_17 AC 89 ms
76,828 KB
testcase_18 AC 80 ms
76,104 KB
testcase_19 AC 77 ms
75,436 KB
testcase_20 AC 82 ms
76,788 KB
testcase_21 AC 80 ms
76,360 KB
testcase_22 AC 99 ms
85,920 KB
testcase_23 AC 91 ms
76,716 KB
testcase_24 AC 87 ms
76,416 KB
testcase_25 AC 113 ms
85,620 KB
testcase_26 AC 94 ms
76,620 KB
testcase_27 AC 84 ms
76,568 KB
testcase_28 AC 257 ms
176,980 KB
testcase_29 AC 222 ms
113,268 KB
testcase_30 AC 218 ms
140,812 KB
testcase_31 AC 100 ms
86,636 KB
testcase_32 AC 258 ms
143,268 KB
testcase_33 AC 238 ms
119,028 KB
testcase_34 AC 213 ms
156,288 KB
testcase_35 AC 261 ms
181,224 KB
testcase_36 AC 428 ms
175,652 KB
testcase_37 AC 186 ms
105,984 KB
testcase_38 AC 179 ms
94,720 KB
testcase_39 AC 313 ms
140,724 KB
testcase_40 AC 376 ms
173,152 KB
testcase_41 AC 296 ms
193,900 KB
testcase_42 AC 297 ms
127,536 KB
testcase_43 AC 242 ms
117,040 KB
testcase_44 AC 142 ms
97,664 KB
testcase_45 AC 250 ms
151,488 KB
testcase_46 AC 119 ms
84,072 KB
testcase_47 AC 891 ms
296,784 KB
testcase_48 AC 167 ms
84,224 KB
testcase_49 AC 122 ms
84,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K = map(int,input().split())
l = []
MOD = 10**9+7
NUM = 300

for _ in range(M):
  p,q,c = map(int,input().split())
  p -= 1
  q -= 1
  l.append((p,q,c))

dp = [[[0 for _ in range(K+1)] for _ in range(NUM)] for _ in range(N)]

for i in range(NUM):
  dp[0][i][0] = 1
for i in range(N-1):
  for j in range(M):
    p,q,c = l[j]
    for k in range(K+1-c):
      dp[i+1][q][k+c] += dp[i][p][k]
      dp[i+1][q][k+c] %= MOD

ans = 0

for i in range(NUM):
  ans += dp[N-1][i][K]

print(ans%MOD)
0