結果

問題 No.1111 コード進行
ユーザー roarisroaris
提出日時 2020-07-10 21:42:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,093 ms / 2,000 ms
コード長 649 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 82,588 KB
実行使用メモリ 296,548 KB
最終ジャッジ日時 2024-04-19 16:30:25
合計ジャッジ時間 8,352 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
61,440 KB
testcase_01 AC 40 ms
60,928 KB
testcase_02 AC 41 ms
54,400 KB
testcase_03 AC 40 ms
54,016 KB
testcase_04 AC 40 ms
54,400 KB
testcase_05 AC 49 ms
66,432 KB
testcase_06 AC 68 ms
81,192 KB
testcase_07 AC 52 ms
70,416 KB
testcase_08 AC 50 ms
67,456 KB
testcase_09 AC 62 ms
74,240 KB
testcase_10 AC 73 ms
82,920 KB
testcase_11 AC 52 ms
66,688 KB
testcase_12 AC 68 ms
80,892 KB
testcase_13 AC 56 ms
71,808 KB
testcase_14 AC 83 ms
83,148 KB
testcase_15 AC 50 ms
67,712 KB
testcase_16 AC 73 ms
81,408 KB
testcase_17 AC 56 ms
73,088 KB
testcase_18 AC 48 ms
66,048 KB
testcase_19 AC 46 ms
64,128 KB
testcase_20 AC 50 ms
67,200 KB
testcase_21 AC 46 ms
64,128 KB
testcase_22 AC 69 ms
85,248 KB
testcase_23 AC 53 ms
69,120 KB
testcase_24 AC 51 ms
69,504 KB
testcase_25 AC 78 ms
84,568 KB
testcase_26 AC 57 ms
70,912 KB
testcase_27 AC 51 ms
68,608 KB
testcase_28 AC 210 ms
181,120 KB
testcase_29 AC 139 ms
123,776 KB
testcase_30 AC 198 ms
148,864 KB
testcase_31 AC 73 ms
88,536 KB
testcase_32 AC 313 ms
143,968 KB
testcase_33 AC 287 ms
118,528 KB
testcase_34 AC 181 ms
156,160 KB
testcase_35 AC 209 ms
180,384 KB
testcase_36 AC 484 ms
185,264 KB
testcase_37 AC 190 ms
105,728 KB
testcase_38 AC 153 ms
97,772 KB
testcase_39 AC 308 ms
147,584 KB
testcase_40 AC 385 ms
176,884 KB
testcase_41 AC 260 ms
199,148 KB
testcase_42 AC 262 ms
127,868 KB
testcase_43 AC 267 ms
120,540 KB
testcase_44 AC 119 ms
100,864 KB
testcase_45 AC 229 ms
151,524 KB
testcase_46 AC 71 ms
83,712 KB
testcase_47 AC 1,093 ms
296,548 KB
testcase_48 AC 55 ms
72,576 KB
testcase_49 AC 57 ms
73,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N, M, K = map(int, input().split())
G = [[] for _ in range(300)]

for _ in range(M):
    P, Q, C = map(int, input().split())
    G[P-1].append((Q-1, C))
    
dp = [[[0]*(K+1) for _ in range(300)] for _ in range(N)]

for i in range(300):
    dp[0][i][0] = 1

MOD = 10**9+7

for i in range(N-1):
    for j in range(300):
        for k in range(K+1):
            for nj, C in G[j]:
                if k+C<=K:
                    dp[i+1][nj][k+C] += dp[i][j][k]
                    dp[i+1][nj][k+C] %= MOD

ans = 0

for i in range(300):
    ans += dp[N-1][i][K]
    ans %= MOD

print(ans)
0