結果

問題 No.1111 コード進行
ユーザー 👑 tamatotamato
提出日時 2020-07-10 21:38:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 702 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 87,412 KB
実行使用メモリ 93,068 KB
最終ジャッジ日時 2023-08-01 17:03:49
合計ジャッジ時間 8,162 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,788 KB
testcase_01 AC 75 ms
71,352 KB
testcase_02 AC 76 ms
71,688 KB
testcase_03 AC 73 ms
71,536 KB
testcase_04 AC 74 ms
71,312 KB
testcase_05 AC 80 ms
76,008 KB
testcase_06 AC 86 ms
76,452 KB
testcase_07 AC 85 ms
76,632 KB
testcase_08 AC 85 ms
76,852 KB
testcase_09 AC 84 ms
76,632 KB
testcase_10 AC 85 ms
76,756 KB
testcase_11 AC 82 ms
76,592 KB
testcase_12 AC 85 ms
76,604 KB
testcase_13 AC 82 ms
76,640 KB
testcase_14 AC 90 ms
76,444 KB
testcase_15 AC 81 ms
76,720 KB
testcase_16 AC 87 ms
76,712 KB
testcase_17 AC 85 ms
76,768 KB
testcase_18 AC 78 ms
75,944 KB
testcase_19 AC 77 ms
75,548 KB
testcase_20 AC 79 ms
76,120 KB
testcase_21 AC 83 ms
76,840 KB
testcase_22 AC 83 ms
76,564 KB
testcase_23 AC 83 ms
77,036 KB
testcase_24 AC 83 ms
76,724 KB
testcase_25 AC 92 ms
76,884 KB
testcase_26 AC 83 ms
76,752 KB
testcase_27 AC 80 ms
76,640 KB
testcase_28 AC 108 ms
82,576 KB
testcase_29 AC 96 ms
78,384 KB
testcase_30 AC 113 ms
80,228 KB
testcase_31 AC 87 ms
77,864 KB
testcase_32 AC 159 ms
78,696 KB
testcase_33 AC 131 ms
78,828 KB
testcase_34 AC 101 ms
80,804 KB
testcase_35 AC 110 ms
81,616 KB
testcase_36 AC 188 ms
82,476 KB
testcase_37 AC 114 ms
77,640 KB
testcase_38 AC 139 ms
78,276 KB
testcase_39 AC 159 ms
80,740 KB
testcase_40 AC 173 ms
82,064 KB
testcase_41 AC 121 ms
82,440 KB
testcase_42 AC 132 ms
77,696 KB
testcase_43 AC 133 ms
78,856 KB
testcase_44 AC 95 ms
77,428 KB
testcase_45 AC 116 ms
79,548 KB
testcase_46 AC 93 ms
77,232 KB
testcase_47 AC 338 ms
93,068 KB
testcase_48 AC 93 ms
77,408 KB
testcase_49 AC 94 ms
77,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N, M, K = map(int, input().split())
    dp = [[0] * (K+1) for _ in range(301)]
    for p in range(1, 301):
        dp[p][0] = 1
    code = []
    for _ in range(M):
        code.append(tuple(map(int, input().split())))
    for _ in range(N-1):
        dp_new = [[0] * (K+1) for _ in range(301)]
        for p, q, c in code:
            for k in range(K+1):
                if k + c <= K:
                    dp_new[q][k+c] = (dp_new[q][k+c] + dp[p][k])%mod
        dp = dp_new
    ans = 0
    for q in range(1, 301):
        ans = (ans + dp[q][K])%mod
    print(ans)


if __name__ == '__main__':
    main()
0