結果

問題 No.1111 コード進行
ユーザー ttrttr
提出日時 2020-08-05 20:09:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 598 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 81,636 KB
実行使用メモリ 97,088 KB
最終ジャッジ日時 2023-10-17 12:20:13
合計ジャッジ時間 7,745 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,360 KB
testcase_01 AC 38 ms
53,360 KB
testcase_02 AC 38 ms
53,360 KB
testcase_03 AC 40 ms
53,360 KB
testcase_04 AC 38 ms
53,360 KB
testcase_05 AC 40 ms
55,408 KB
testcase_06 AC 63 ms
68,416 KB
testcase_07 AC 60 ms
70,440 KB
testcase_08 AC 58 ms
66,340 KB
testcase_09 AC 58 ms
65,944 KB
testcase_10 AC 63 ms
70,464 KB
testcase_11 AC 56 ms
66,328 KB
testcase_12 AC 64 ms
70,468 KB
testcase_13 AC 57 ms
68,392 KB
testcase_14 AC 69 ms
72,496 KB
testcase_15 AC 52 ms
64,260 KB
testcase_16 AC 65 ms
70,448 KB
testcase_17 AC 56 ms
70,424 KB
testcase_18 AC 45 ms
61,684 KB
testcase_19 AC 38 ms
53,360 KB
testcase_20 AC 51 ms
65,952 KB
testcase_21 AC 48 ms
62,012 KB
testcase_22 AC 57 ms
72,488 KB
testcase_23 AC 56 ms
68,392 KB
testcase_24 AC 57 ms
68,416 KB
testcase_25 AC 69 ms
73,548 KB
testcase_26 AC 65 ms
70,464 KB
testcase_27 AC 49 ms
61,796 KB
testcase_28 AC 88 ms
84,344 KB
testcase_29 AC 78 ms
76,752 KB
testcase_30 AC 114 ms
80,700 KB
testcase_31 AC 63 ms
76,560 KB
testcase_32 AC 159 ms
77,884 KB
testcase_33 AC 162 ms
78,436 KB
testcase_34 AC 81 ms
81,456 KB
testcase_35 AC 88 ms
81,004 KB
testcase_36 AC 274 ms
84,144 KB
testcase_37 AC 120 ms
76,300 KB
testcase_38 AC 110 ms
75,876 KB
testcase_39 AC 214 ms
80,760 KB
testcase_40 AC 226 ms
82,864 KB
testcase_41 AC 106 ms
83,968 KB
testcase_42 AC 156 ms
76,612 KB
testcase_43 AC 162 ms
77,624 KB
testcase_44 AC 81 ms
75,976 KB
testcase_45 AC 115 ms
79,136 KB
testcase_46 AC 60 ms
72,412 KB
testcase_47 AC 598 ms
97,088 KB
testcase_48 AC 60 ms
72,412 KB
testcase_49 AC 62 ms
72,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K = map(int, input().split())
L = [[int(l) for l in input().split()] for _ in range(M)]
mod = 10**9+7

num = 301
dp = [[[0]*(K+1) for _ in range(num)] for _ in range(2)]

for l in L:
    if l[2] > K:
        continue
    dp[1][l[1]][l[2]] += 1
for i in range(N-2):
    dp[i%2] = [[0]*(K+1) for _ in range(num)]
    for l in L:
        for k in range(K+1):
            if k+l[2] > K:
                continue
            dp[i%2][l[1]][k+l[2]] += dp[(i+1)%2][l[0]][k]
            dp[i%2][l[1]][k+l[2]] %= mod

ans = 0
for i in range(num):
    ans += dp[(N-1)%2][i][K]
    ans %= mod
print(ans)
0