結果

問題 No.1111 コード進行
ユーザー anagohirameanagohirame
提出日時 2020-07-10 22:32:18
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 817 bytes
コンパイル時間 1,124 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 515,968 KB
最終ジャッジ日時 2024-04-19 17:45:04
合計ジャッジ時間 13,538 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
62,848 KB
testcase_01 AC 38 ms
60,416 KB
testcase_02 AC 37 ms
53,248 KB
testcase_03 AC 37 ms
53,504 KB
testcase_04 AC 37 ms
53,504 KB
testcase_05 AC 45 ms
64,512 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 39 ms
61,440 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 40 ms
62,720 KB
testcase_28 AC 338 ms
282,624 KB
testcase_29 AC 179 ms
168,320 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 255 ms
224,640 KB
testcase_35 AC 328 ms
277,120 KB
testcase_36 AC 477 ms
293,632 KB
testcase_37 AC 215 ms
135,780 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 471 ms
316,032 KB
testcase_42 AC 234 ms
179,184 KB
testcase_43 WA -
testcase_44 AC 119 ms
123,008 KB
testcase_45 AC 234 ms
215,680 KB
testcase_46 AC 97 ms
90,240 KB
testcase_47 MLE -
testcase_48 AC 143 ms
90,496 KB
testcase_49 AC 88 ms
87,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input():
	return sys.stdin.buffer.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(300)]
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:
		dp[i][j][l] = 1
		visited[i][j][l] = True		
		return 1
	elif i <= 0 or l < 0:
		dp[i][j][l] = 0
		visited[i][j][l] = True
		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