結果

問題 No.1111 コード進行
ユーザー qibqib
提出日時 2023-02-13 01:38:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 474 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 99,276 KB
最終ジャッジ日時 2023-09-23 08:28:29
合計ジャッジ時間 8,751 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,092 KB
testcase_01 AC 77 ms
71,184 KB
testcase_02 AC 76 ms
71,112 KB
testcase_03 AC 74 ms
71,152 KB
testcase_04 AC 79 ms
71,112 KB
testcase_05 AC 74 ms
71,068 KB
testcase_06 AC 86 ms
76,108 KB
testcase_07 AC 91 ms
76,160 KB
testcase_08 AC 84 ms
75,976 KB
testcase_09 AC 86 ms
76,092 KB
testcase_10 AC 81 ms
75,928 KB
testcase_11 AC 81 ms
75,912 KB
testcase_12 AC 89 ms
76,168 KB
testcase_13 AC 77 ms
75,100 KB
testcase_14 AC 97 ms
76,132 KB
testcase_15 AC 80 ms
76,196 KB
testcase_16 AC 88 ms
76,124 KB
testcase_17 AC 77 ms
74,944 KB
testcase_18 AC 77 ms
74,968 KB
testcase_19 AC 76 ms
71,352 KB
testcase_20 AC 75 ms
71,352 KB
testcase_21 AC 79 ms
74,944 KB
testcase_22 AC 77 ms
75,000 KB
testcase_23 AC 80 ms
75,848 KB
testcase_24 AC 79 ms
75,760 KB
testcase_25 AC 98 ms
76,188 KB
testcase_26 AC 99 ms
76,052 KB
testcase_27 AC 76 ms
71,344 KB
testcase_28 AC 79 ms
74,948 KB
testcase_29 AC 85 ms
76,060 KB
testcase_30 AC 184 ms
77,376 KB
testcase_31 AC 88 ms
75,972 KB
testcase_32 AC 276 ms
77,652 KB
testcase_33 AC 319 ms
78,800 KB
testcase_34 AC 81 ms
75,976 KB
testcase_35 AC 80 ms
75,924 KB
testcase_36 AC 94 ms
76,200 KB
testcase_37 AC 96 ms
76,208 KB
testcase_38 AC 185 ms
77,928 KB
testcase_39 AC 474 ms
85,672 KB
testcase_40 AC 428 ms
99,276 KB
testcase_41 AC 82 ms
75,924 KB
testcase_42 AC 104 ms
76,896 KB
testcase_43 AC 326 ms
87,148 KB
testcase_44 AC 83 ms
75,872 KB
testcase_45 AC 82 ms
75,852 KB
testcase_46 AC 106 ms
76,968 KB
testcase_47 AC 104 ms
77,028 KB
testcase_48 AC 100 ms
77,092 KB
testcase_49 AC 90 ms
76,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7

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

dp = [{ 0 : 1 } for _ in range(300)]
for _ in range(n - 1):
  ndp = [{} for _ in range(300)]
  for u, v, c in edges:
    for cur, cnt in dp[u].items():
      if cur + c <= k:
        ndp[v][cur + c] = (ndp[v].get(cur + c, 0) + cnt) % MOD

  dp = ndp

ans = 0
for v in range(300):
  ans = (ans + dp[v].get(k, 0)) % MOD

print(ans)
0