結果

問題 No.1111 コード進行
ユーザー anagohirameanagohirame
提出日時 2020-07-10 22:41:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 797 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 135,552 KB
最終ジャッジ日時 2024-04-19 17:54:22
合計ジャッジ時間 7,341 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
61,184 KB
testcase_01 AC 43 ms
60,800 KB
testcase_02 AC 35 ms
52,864 KB
testcase_03 AC 34 ms
52,864 KB
testcase_04 AC 33 ms
52,736 KB
testcase_05 AC 47 ms
66,432 KB
testcase_06 AC 68 ms
77,952 KB
testcase_07 AC 70 ms
77,568 KB
testcase_08 AC 63 ms
72,192 KB
testcase_09 AC 62 ms
71,936 KB
testcase_10 AC 70 ms
77,312 KB
testcase_11 AC 58 ms
71,296 KB
testcase_12 AC 71 ms
77,696 KB
testcase_13 AC 67 ms
78,080 KB
testcase_14 AC 86 ms
78,848 KB
testcase_15 AC 59 ms
73,600 KB
testcase_16 AC 70 ms
78,080 KB
testcase_17 AC 67 ms
77,440 KB
testcase_18 AC 54 ms
70,272 KB
testcase_19 AC 46 ms
63,232 KB
testcase_20 AC 58 ms
70,400 KB
testcase_21 AC 45 ms
65,152 KB
testcase_22 AC 75 ms
78,336 KB
testcase_23 AC 66 ms
76,928 KB
testcase_24 AC 66 ms
77,312 KB
testcase_25 AC 78 ms
77,568 KB
testcase_26 AC 68 ms
77,056 KB
testcase_27 AC 57 ms
68,992 KB
testcase_28 AC 172 ms
85,236 KB
testcase_29 AC 119 ms
78,916 KB
testcase_30 AC 159 ms
83,072 KB
testcase_31 AC 73 ms
77,720 KB
testcase_32 AC 187 ms
79,360 KB
testcase_33 AC 220 ms
85,272 KB
testcase_34 AC 139 ms
81,792 KB
testcase_35 AC 154 ms
81,920 KB
testcase_36 AC 400 ms
92,544 KB
testcase_37 AC 162 ms
78,252 KB
testcase_38 AC 137 ms
77,916 KB
testcase_39 AC 235 ms
83,200 KB
testcase_40 AC 310 ms
87,916 KB
testcase_41 AC 201 ms
86,120 KB
testcase_42 AC 219 ms
80,384 KB
testcase_43 AC 218 ms
82,944 KB
testcase_44 AC 113 ms
77,756 KB
testcase_45 AC 189 ms
82,432 KB
testcase_46 AC 72 ms
76,416 KB
testcase_47 AC 797 ms
135,552 KB
testcase_48 AC 69 ms
75,776 KB
testcase_49 AC 67 ms
76,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input():
	return sys.stdin.buffer.readline()[:-1]

MAX = 300
MOD = 10**9+7
n, m, K = map(int, input().split())
dp = [[0 for _ in range(K+1)] for _ in range(MAX)]
for i in range(MAX):
	dp[i][0] = 1

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

for _ in range(n-1):
	new = [[0 for _ in range(K+1)] for _ in range(MAX)]
	for p in range(MAX):
		for j in range(K+1):
			for q, c in adj[p]:
				if j+c <= K:
					new[q][j+c] += dp[p][j]
					new[q][j+c] %= MOD
	dp = new

ans = 0
for p in range(MAX):
	ans += dp[p][K]
	ans %= MOD
print(ans)
0