結果

問題 No.1111 コード進行
ユーザー tcltktcltk
提出日時 2021-01-17 15:15:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,219 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 41,232 KB
最終ジャッジ日時 2024-05-07 04:24:02
合計ジャッジ時間 5,091 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
18,848 KB
testcase_01 AC 38 ms
12,032 KB
testcase_02 AC 37 ms
11,776 KB
testcase_03 AC 37 ms
11,904 KB
testcase_04 AC 37 ms
11,904 KB
testcase_05 AC 71 ms
16,256 KB
testcase_06 AC 913 ms
23,808 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """4 6 2
# 1 2 0
# 1 3 0
# 2 1 1
# 3 1 0
# 2 3 0
# 3 2 2
# """
# sys.stdin = io.StringIO(_INPUT)

MOD = 1000000007

def main():
    N, M, K = map(int, input().split())
    P = [None for _ in range(M)]
    Q = [None for _ in range(M)]
    C = [None for _ in range(M)]
    for i in range(M):
        P[i], Q[i], C[i] = map(int, input().split())
        P[i] -= 1
        Q[i] -= 1

    Kmax = max(C) * N
    dp = [[0 for _ in range(Kmax+1)] for _ in range(300)]
    for j in range(300):
        dp[j][0] = 1

    for i in range(N-1):
        dp1 = [[0 for _ in range(Kmax+1)] for _ in range(300)]
        for m in range(M):
            for k in range(Kmax+1):
                if k + C[m] <= Kmax:
                    dp1[Q[m]][k+C[m]] = (dp1[Q[m]][k+C[m]] + dp[P[m]][k]) % MOD
        dp = dp1

    n = 0
    for j in range(300):
        n += dp[j][K]
    print(n % MOD)

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