結果

問題 No.1111 コード進行
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-07-10 22:00:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 835 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 121,984 KB
最終ジャッジ日時 2024-04-19 17:07:30
合計ジャッジ時間 14,971 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
121,856 KB
testcase_01 AC 33 ms
10,880 KB
testcase_02 AC 27 ms
10,880 KB
testcase_03 WA -
testcase_04 AC 31 ms
10,880 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 68 ms
17,024 KB
testcase_08 AC 43 ms
12,544 KB
testcase_09 WA -
testcase_10 AC 74 ms
19,712 KB
testcase_11 AC 40 ms
12,928 KB
testcase_12 WA -
testcase_13 AC 82 ms
17,664 KB
testcase_14 WA -
testcase_15 AC 35 ms
11,776 KB
testcase_16 AC 79 ms
20,608 KB
testcase_17 AC 79 ms
20,352 KB
testcase_18 AC 38 ms
12,544 KB
testcase_19 AC 60 ms
14,976 KB
testcase_20 AC 71 ms
17,024 KB
testcase_21 AC 32 ms
11,008 KB
testcase_22 AC 84 ms
24,064 KB
testcase_23 AC 57 ms
15,744 KB
testcase_24 AC 68 ms
18,048 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 57 ms
15,232 KB
testcase_28 AC 484 ms
121,984 KB
testcase_29 AC 218 ms
56,064 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 AC 377 ms
91,648 KB
testcase_35 AC 467 ms
111,104 KB
testcase_36 AC 488 ms
120,576 KB
testcase_37 AC 145 ms
36,864 KB
testcase_38 WA -
testcase_39 TLE -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

グラフ
メモ化再帰
各頂点で開始、複雑さXのものはいくつあるかをメモ化再帰で求める
N * 300 なので行ける

"""
import sys
sys.setrecursionlimit(27000000)
mod = 10**9+7

def dfs(v,k,n):

    if k == 0 and n == 0:
        return 1
    elif k < 0 or n <= 0:
        return 0
    elif visit[v][k][n] != None:
        return visit[v][k][n]

    ret = 0
    for nex,cost in lis[v]:
        ret += dfs(nex , k-cost , n-1)
        ret %= mod

    visit[v][k][n] = ret
    return ret

N,M,K = map(int,input().split())

lis = [ [] for i in range(300) ]
visit = [[[None] * N for j in range(K+1)] for i in range(300)]


for i in range(M):

    P,Q,C = map(int,input().split())
    P -= 1
    Q -= 1
    lis[P].append((Q,C))

ans = 0
for i in range(N):
    ans += dfs(i,K,N-1)
    ans %= mod
print (ans)
0