結果

問題 No.1111 コード進行
ユーザー anagohirameanagohirame
提出日時 2020-07-10 22:30:24
言語 PyPy3
(7.3.13)
結果
RE  
実行時間 -
コード長 720 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 516,836 KB
最終ジャッジ日時 2023-08-01 18:32:44
合計ジャッジ時間 20,113 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
76,200 KB
testcase_01 AC 77 ms
75,160 KB
testcase_02 AC 75 ms
71,212 KB
testcase_03 AC 73 ms
71,140 KB
testcase_04 AC 73 ms
71,092 KB
testcase_05 AC 79 ms
75,084 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 77 ms
75,048 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 WA -
testcase_27 AC 81 ms
75,408 KB
testcase_28 AC 432 ms
282,352 KB
testcase_29 AC 242 ms
168,088 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 334 ms
224,212 KB
testcase_35 AC 426 ms
276,776 KB
testcase_36 AC 532 ms
295,676 KB
testcase_37 AC 287 ms
137,644 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 TLE -
testcase_41 AC 541 ms
316,124 KB
testcase_42 AC 323 ms
189,632 KB
testcase_43 WA -
testcase_44 AC 167 ms
122,852 KB
testcase_45 AC 321 ms
215,816 KB
testcase_46 AC 152 ms
91,580 KB
testcase_47 MLE -
testcase_48 AC 198 ms
91,704 KB
testcase_49 AC 132 ms
88,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

MOD = 10**9+7
n, m, k = map(int, input().split())
dp = [[[0 for _ in range(k+1)] for _ in range(300)] for _ in range(n)]
visited = [[[False for _ in range(k+1)] for _ in range(300)] for _ in range(n)]

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

def rec(i, j, l):
	if visited[i][j][l]:
		return dp[i][j][l]
	if i == 0 and l == 0:
		return 1
	elif i <= 0 or l < 0:
		return 0
	else:
		res = 0
		for p, c in adj[j]:
			res += rec(i-1, p, l-c)
			res %= MOD
		dp[i][j][l] = res
		visited[i][j][l] = True
		return res

ans = 0
for j in range(300):
	ans += rec(n-1, j, k)
	ans %= MOD

print(ans)
0