結果

問題 No.1111 コード進行
ユーザー takakintakakin
提出日時 2020-07-10 21:48:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 666 ms / 2,000 ms
コード長 503 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 297,532 KB
最終ジャッジ日時 2024-04-19 16:44:31
合計ジャッジ時間 6,531 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
58,736 KB
testcase_01 AC 35 ms
59,132 KB
testcase_02 AC 33 ms
53,084 KB
testcase_03 AC 33 ms
52,492 KB
testcase_04 AC 34 ms
53,740 KB
testcase_05 AC 38 ms
61,772 KB
testcase_06 AC 49 ms
69,176 KB
testcase_07 AC 51 ms
69,312 KB
testcase_08 AC 46 ms
65,748 KB
testcase_09 AC 48 ms
65,276 KB
testcase_10 AC 46 ms
70,232 KB
testcase_11 AC 43 ms
64,788 KB
testcase_12 AC 48 ms
68,384 KB
testcase_13 AC 44 ms
65,008 KB
testcase_14 AC 54 ms
72,200 KB
testcase_15 AC 42 ms
62,556 KB
testcase_16 AC 49 ms
68,924 KB
testcase_17 AC 43 ms
67,528 KB
testcase_18 AC 36 ms
60,572 KB
testcase_19 AC 34 ms
54,872 KB
testcase_20 AC 41 ms
63,656 KB
testcase_21 AC 37 ms
59,932 KB
testcase_22 AC 47 ms
71,784 KB
testcase_23 AC 45 ms
66,636 KB
testcase_24 AC 44 ms
65,944 KB
testcase_25 AC 56 ms
74,444 KB
testcase_26 AC 52 ms
70,144 KB
testcase_27 AC 40 ms
61,628 KB
testcase_28 AC 146 ms
182,108 KB
testcase_29 AC 95 ms
113,436 KB
testcase_30 AC 159 ms
136,660 KB
testcase_31 AC 50 ms
74,088 KB
testcase_32 AC 221 ms
135,824 KB
testcase_33 AC 219 ms
113,740 KB
testcase_34 AC 110 ms
137,104 KB
testcase_35 AC 157 ms
180,720 KB
testcase_36 AC 307 ms
181,728 KB
testcase_37 AC 120 ms
90,572 KB
testcase_38 AC 128 ms
90,584 KB
testcase_39 AC 305 ms
136,544 KB
testcase_40 AC 310 ms
177,092 KB
testcase_41 AC 176 ms
182,360 KB
testcase_42 AC 165 ms
112,988 KB
testcase_43 AC 193 ms
114,100 KB
testcase_44 AC 80 ms
91,192 KB
testcase_45 AC 146 ms
136,596 KB
testcase_46 AC 52 ms
72,216 KB
testcase_47 AC 666 ms
297,532 KB
testcase_48 AC 50 ms
70,132 KB
testcase_49 AC 51 ms
71,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,m,k=map(int,input().split())
mod=10**9+7
PQ=[[int(i) for i in input().split()] for _ in range(m)]

DP=[[[0]*(k+1) for i in range(301)] for j in range(n+1)]

for p,q,c in PQ:
  if c<=k:
    DP[2][q][c]+=1
for i in range(2,n):
  for p,q,c in PQ:
    for j in range(k+1-c):
      DP[i+1][q][j+c]+=DP[i][p][j]
      if DP[i+1][q][j+c]>mod:
        DP[i+1][q][j+c]=DP[i+1][q][j+c]%mod
ans=0
for i in range(301):
  ans=(ans+DP[n][i][k])%mod
print(ans)
0