結果

問題 No.1111 コード進行
ユーザー H3PO4H3PO4
提出日時 2020-07-10 23:01:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,175 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 44,468 KB
最終ジャッジ日時 2024-04-19 22:28:14
合計ジャッジ時間 30,371 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 465 ms
44,460 KB
testcase_01 AC 476 ms
44,468 KB
testcase_02 AC 476 ms
43,956 KB
testcase_03 AC 468 ms
44,336 KB
testcase_04 AC 467 ms
43,832 KB
testcase_05 AC 469 ms
44,076 KB
testcase_06 AC 491 ms
44,216 KB
testcase_07 AC 481 ms
43,836 KB
testcase_08 AC 484 ms
44,340 KB
testcase_09 AC 472 ms
44,084 KB
testcase_10 AC 480 ms
44,212 KB
testcase_11 AC 473 ms
44,336 KB
testcase_12 AC 488 ms
43,936 KB
testcase_13 AC 479 ms
44,220 KB
testcase_14 AC 488 ms
44,340 KB
testcase_15 AC 471 ms
43,820 KB
testcase_16 AC 481 ms
44,216 KB
testcase_17 AC 489 ms
44,344 KB
testcase_18 AC 470 ms
44,204 KB
testcase_19 AC 484 ms
43,824 KB
testcase_20 AC 468 ms
44,088 KB
testcase_21 AC 463 ms
44,336 KB
testcase_22 AC 473 ms
44,464 KB
testcase_23 AC 475 ms
44,080 KB
testcase_24 AC 469 ms
43,828 KB
testcase_25 AC 494 ms
44,220 KB
testcase_26 AC 482 ms
43,964 KB
testcase_27 AC 473 ms
43,960 KB
testcase_28 AC 466 ms
44,084 KB
testcase_29 AC 492 ms
44,208 KB
testcase_30 AC 532 ms
43,824 KB
testcase_31 AC 466 ms
44,308 KB
testcase_32 AC 645 ms
43,836 KB
testcase_33 AC 615 ms
43,948 KB
testcase_34 AC 475 ms
44,464 KB
testcase_35 AC 475 ms
43,960 KB
testcase_36 AC 751 ms
43,820 KB
testcase_37 AC 670 ms
44,212 KB
testcase_38 AC 641 ms
44,212 KB
testcase_39 AC 684 ms
44,468 KB
testcase_40 AC 722 ms
43,964 KB
testcase_41 AC 505 ms
44,340 KB
testcase_42 AC 677 ms
44,208 KB
testcase_43 AC 654 ms
44,080 KB
testcase_44 AC 525 ms
44,344 KB
testcase_45 AC 552 ms
43,948 KB
testcase_46 AC 955 ms
44,204 KB
testcase_47 AC 1,175 ms
43,952 KB
testcase_48 AC 927 ms
44,076 KB
testcase_49 AC 741 ms
44,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, M, K = map(int, input().split())
PQC = [tuple(map(int, input().split())) for _ in range(M)]
MOD = 10 ** 9 + 7

dp = np.zeros((300, K + 1), dtype=np.int64)
dp[:, 0] = 1

for i in range(N - 1):
    new_dp = np.zeros_like(dp)
    for p, q, c in PQC:
        if c > K:
            continue
        new_dp[q - 1, c:] += dp[p - 1, :K + 1 - c]
        new_dp[q - 1] %= MOD
    dp = new_dp
print(sum(dp[:, -1]) % MOD)
0