結果

問題 No.1111 コード進行
ユーザー AEnAEn
提出日時 2022-05-20 10:35:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 497 ms / 2,000 ms
コード長 779 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 295,440 KB
最終ジャッジ日時 2023-10-19 21:58:47
合計ジャッジ時間 8,918 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
60,000 KB
testcase_01 AC 45 ms
59,792 KB
testcase_02 AC 40 ms
53,520 KB
testcase_03 AC 40 ms
53,520 KB
testcase_04 AC 41 ms
53,520 KB
testcase_05 AC 48 ms
61,912 KB
testcase_06 AC 59 ms
68,420 KB
testcase_07 AC 59 ms
68,512 KB
testcase_08 AC 52 ms
64,168 KB
testcase_09 AC 59 ms
66,476 KB
testcase_10 AC 55 ms
68,264 KB
testcase_11 AC 50 ms
62,120 KB
testcase_12 AC 60 ms
68,524 KB
testcase_13 AC 53 ms
64,168 KB
testcase_14 AC 72 ms
72,620 KB
testcase_15 AC 49 ms
62,120 KB
testcase_16 AC 63 ms
70,572 KB
testcase_17 AC 55 ms
68,264 KB
testcase_18 AC 49 ms
62,120 KB
testcase_19 AC 42 ms
53,520 KB
testcase_20 AC 45 ms
62,120 KB
testcase_21 AC 49 ms
62,048 KB
testcase_22 AC 56 ms
70,312 KB
testcase_23 AC 51 ms
64,168 KB
testcase_24 AC 55 ms
66,360 KB
testcase_25 AC 70 ms
72,732 KB
testcase_26 AC 67 ms
70,592 KB
testcase_27 AC 49 ms
61,912 KB
testcase_28 AC 259 ms
181,488 KB
testcase_29 AC 146 ms
112,972 KB
testcase_30 AC 246 ms
148,028 KB
testcase_31 AC 87 ms
87,784 KB
testcase_32 AC 290 ms
143,180 KB
testcase_33 AC 248 ms
112,520 KB
testcase_34 AC 212 ms
155,076 KB
testcase_35 AC 259 ms
179,360 KB
testcase_36 AC 274 ms
180,760 KB
testcase_37 AC 134 ms
104,696 KB
testcase_38 AC 178 ms
96,868 KB
testcase_39 AC 398 ms
146,940 KB
testcase_40 AC 441 ms
176,052 KB
testcase_41 AC 273 ms
181,736 KB
testcase_42 AC 154 ms
112,112 KB
testcase_43 AC 281 ms
119,496 KB
testcase_44 AC 92 ms
90,280 KB
testcase_45 AC 191 ms
135,788 KB
testcase_46 AC 68 ms
72,560 KB
testcase_47 AC 497 ms
295,440 KB
testcase_48 AC 67 ms
72,580 KB
testcase_49 AC 57 ms
70,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, K = map(int, input().split())
code = [list() for _ in range(300)]
for i in range(M):
    p, q, c = map(int, input().split())
    code[p-1].append([q-1, c])

mod = 10**9+7
dp = [[[0]*(K+1) for _ in range(300)] for _ in range(N)]
for i in range(N-1):
    if i == 0:
        for j in range(300):
            for nex, c in code[j]:
                if c <= K:
                    dp[i+1][nex][c] += 1
    else:
        for j in range(300):
            for k in range(K+1):
                if dp[i][j][k] > 0:
                    for nex, c in code[j]:
                        if k+c <= K:
                            dp[i+1][nex][k+c] += dp[i][j][k]
                            dp[i+1][nex][k+c] %= mod
sm = 0
for i in range(300):
    sm += dp[-1][i][-1]
    sm %= mod
print(sm)
0