結果

問題 No.1111 コード進行
ユーザー kohei2019kohei2019
提出日時 2022-07-18 00:48:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 529 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 1,139 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 92,652 KB
最終ジャッジ日時 2023-09-12 12:51:58
合計ジャッジ時間 9,411 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,548 KB
testcase_01 AC 77 ms
71,636 KB
testcase_02 AC 76 ms
71,212 KB
testcase_03 AC 75 ms
71,632 KB
testcase_04 AC 76 ms
71,560 KB
testcase_05 AC 82 ms
76,340 KB
testcase_06 AC 97 ms
76,744 KB
testcase_07 AC 99 ms
76,764 KB
testcase_08 AC 94 ms
76,696 KB
testcase_09 AC 93 ms
76,712 KB
testcase_10 AC 93 ms
76,744 KB
testcase_11 AC 91 ms
76,628 KB
testcase_12 AC 99 ms
76,680 KB
testcase_13 AC 92 ms
76,784 KB
testcase_14 AC 113 ms
79,496 KB
testcase_15 AC 89 ms
76,608 KB
testcase_16 AC 103 ms
76,924 KB
testcase_17 AC 88 ms
76,512 KB
testcase_18 AC 80 ms
75,684 KB
testcase_19 AC 79 ms
76,324 KB
testcase_20 AC 86 ms
76,496 KB
testcase_21 AC 83 ms
76,240 KB
testcase_22 AC 96 ms
79,036 KB
testcase_23 AC 93 ms
76,604 KB
testcase_24 AC 91 ms
76,460 KB
testcase_25 AC 112 ms
78,804 KB
testcase_26 AC 100 ms
76,744 KB
testcase_27 AC 87 ms
76,172 KB
testcase_28 AC 120 ms
84,100 KB
testcase_29 AC 108 ms
78,536 KB
testcase_30 AC 148 ms
81,780 KB
testcase_31 AC 95 ms
78,848 KB
testcase_32 AC 173 ms
79,444 KB
testcase_33 AC 190 ms
80,444 KB
testcase_34 AC 111 ms
81,616 KB
testcase_35 AC 116 ms
81,084 KB
testcase_36 AC 321 ms
83,984 KB
testcase_37 AC 148 ms
78,064 KB
testcase_38 AC 139 ms
77,496 KB
testcase_39 AC 247 ms
81,820 KB
testcase_40 AC 269 ms
83,056 KB
testcase_41 AC 155 ms
84,728 KB
testcase_42 AC 184 ms
78,832 KB
testcase_43 AC 194 ms
79,292 KB
testcase_44 AC 119 ms
78,084 KB
testcase_45 AC 160 ms
80,448 KB
testcase_46 AC 96 ms
76,768 KB
testcase_47 AC 529 ms
92,652 KB
testcase_48 AC 95 ms
76,776 KB
testcase_49 AC 98 ms
76,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,K = map(int, input().split())
lsPOC = [[] for i in range(300)]
mod = 10**9+7
for i in range(M):
    P,O,C = map(int, input().split())
    P -= 1
    O -= 1
    lsPOC[P].append((O,C))
dp = [[0]*300 for i in range(K+1)]
dp[0] = [1]*300
for i in range(1,N):
    dp2 = [[0]*300 for i in range(K+1)]
    for j in range(300):
        for q,c in lsPOC[j]:
            for k in range(K+1):
                if c+k <= K:
                    dp2[c+k][q] += dp[k][j]
                    dp2[c+k][q] %= mod
    dp = dp2
print(sum(dp[K])%mod)
0