結果

問題 No.1111 コード進行
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-08 13:38:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 1,371 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 91,408 KB
最終ジャッジ日時 2023-09-30 19:26:51
合計ジャッジ時間 8,091 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,812 KB
testcase_01 AC 72 ms
70,540 KB
testcase_02 AC 71 ms
70,644 KB
testcase_03 AC 70 ms
70,556 KB
testcase_04 AC 74 ms
70,920 KB
testcase_05 AC 76 ms
75,032 KB
testcase_06 AC 84 ms
76,000 KB
testcase_07 AC 87 ms
75,788 KB
testcase_08 AC 86 ms
75,892 KB
testcase_09 AC 84 ms
75,904 KB
testcase_10 AC 86 ms
75,896 KB
testcase_11 AC 83 ms
75,892 KB
testcase_12 AC 90 ms
75,884 KB
testcase_13 AC 80 ms
75,896 KB
testcase_14 AC 94 ms
75,800 KB
testcase_15 AC 81 ms
76,024 KB
testcase_16 AC 89 ms
75,796 KB
testcase_17 AC 79 ms
75,880 KB
testcase_18 AC 77 ms
75,496 KB
testcase_19 AC 76 ms
74,976 KB
testcase_20 AC 77 ms
75,344 KB
testcase_21 AC 92 ms
76,320 KB
testcase_22 AC 81 ms
75,988 KB
testcase_23 AC 82 ms
75,668 KB
testcase_24 AC 81 ms
76,020 KB
testcase_25 AC 94 ms
76,164 KB
testcase_26 AC 92 ms
75,820 KB
testcase_27 AC 80 ms
75,512 KB
testcase_28 AC 101 ms
82,528 KB
testcase_29 AC 93 ms
77,396 KB
testcase_30 AC 138 ms
80,600 KB
testcase_31 AC 87 ms
77,912 KB
testcase_32 AC 180 ms
78,364 KB
testcase_33 AC 200 ms
79,160 KB
testcase_34 AC 104 ms
81,212 KB
testcase_35 AC 100 ms
79,904 KB
testcase_36 AC 149 ms
82,828 KB
testcase_37 AC 108 ms
77,200 KB
testcase_38 AC 136 ms
77,212 KB
testcase_39 AC 259 ms
80,856 KB
testcase_40 AC 230 ms
81,852 KB
testcase_41 AC 106 ms
82,420 KB
testcase_42 AC 121 ms
78,584 KB
testcase_43 AC 192 ms
78,120 KB
testcase_44 AC 92 ms
77,340 KB
testcase_45 AC 104 ms
78,928 KB
testcase_46 AC 89 ms
76,024 KB
testcase_47 AC 238 ms
91,408 KB
testcase_48 AC 89 ms
76,200 KB
testcase_49 AC 88 ms
75,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k = map(int,input().split())
PQC = [list(map(int,input().split())) for i in range(m)]
mod = 10**9+7
s = 300
dp = [[0]*(k+1) for i in range(s)]
for i in range(s):
    dp[i][0] = 1

for i in range(n-1):
    ndp = [[0]*(k+1) for i in range(s)]
    for p,q,c in PQC:
        p,q = p-1,q-1
        for j in range(k+1):
            if dp[p][j] == 0:
                continue
            if j+c <= k:
                ndp[q][j+c] += dp[p][j]
                ndp[q][j+c] %= mod
    dp = ndp

ans = 0
for i in range(s):
    ans += dp[i][k]
    ans %= mod
print(ans)
0