結果

問題 No.1111 コード進行
ユーザー paruf4paruf4
提出日時 2020-07-11 17:42:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 729 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 295,808 KB
最終ジャッジ日時 2024-04-21 08:12:11
合計ジャッジ時間 7,142 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
57,728 KB
testcase_01 AC 38 ms
51,968 KB
testcase_02 AC 37 ms
51,840 KB
testcase_03 AC 38 ms
52,096 KB
testcase_04 AC 38 ms
52,224 KB
testcase_05 AC 45 ms
61,440 KB
testcase_06 AC 52 ms
66,048 KB
testcase_07 AC 58 ms
66,176 KB
testcase_08 AC 52 ms
63,872 KB
testcase_09 AC 52 ms
64,128 KB
testcase_10 AC 52 ms
67,712 KB
testcase_11 AC 49 ms
63,360 KB
testcase_12 AC 56 ms
66,432 KB
testcase_13 AC 49 ms
64,640 KB
testcase_14 AC 60 ms
69,504 KB
testcase_15 AC 49 ms
62,720 KB
testcase_16 AC 57 ms
67,712 KB
testcase_17 AC 51 ms
67,968 KB
testcase_18 AC 45 ms
60,288 KB
testcase_19 AC 43 ms
58,752 KB
testcase_20 AC 49 ms
62,464 KB
testcase_21 AC 45 ms
60,544 KB
testcase_22 AC 51 ms
70,272 KB
testcase_23 AC 51 ms
64,384 KB
testcase_24 AC 50 ms
65,536 KB
testcase_25 AC 62 ms
70,912 KB
testcase_26 AC 57 ms
66,688 KB
testcase_27 AC 49 ms
62,720 KB
testcase_28 AC 167 ms
182,016 KB
testcase_29 AC 105 ms
113,368 KB
testcase_30 AC 150 ms
136,480 KB
testcase_31 AC 53 ms
73,656 KB
testcase_32 AC 197 ms
135,040 KB
testcase_33 AC 176 ms
112,708 KB
testcase_34 AC 123 ms
137,016 KB
testcase_35 AC 172 ms
179,892 KB
testcase_36 AC 336 ms
180,956 KB
testcase_37 AC 127 ms
89,620 KB
testcase_38 AC 135 ms
89,812 KB
testcase_39 AC 252 ms
135,764 KB
testcase_40 AC 280 ms
158,724 KB
testcase_41 AC 187 ms
182,388 KB
testcase_42 AC 179 ms
112,444 KB
testcase_43 AC 179 ms
112,788 KB
testcase_44 AC 90 ms
91,212 KB
testcase_45 AC 159 ms
136,192 KB
testcase_46 AC 59 ms
70,632 KB
testcase_47 AC 729 ms
295,808 KB
testcase_48 AC 67 ms
70,616 KB
testcase_49 AC 69 ms
70,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K=map(int,input().split())
P=[0]*301
Q=[0]*301
C=[0]*301
for i in range(M):
  p,q,c=map(int,input().split())
  P[i]=p-1
  Q[i]=q-1
  C[i]=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

for i in range(N-1):
  for j in range(M):
    p=P[j]
    q=Q[j]
    c=C[j]
    for cost in range(K+1):
      if cost+c>K:continue
      dp[i+1][q][cost+c]+=dp[i][p][cost]
      dp[i+1][q][cost+c]%=mod
ans=0
for i in range(300):
  ans+=dp[N-1][i][K]
  ans%=mod
print(ans)






0