結果

問題 No.1111 コード進行
ユーザー maspymaspy
提出日時 2020-07-10 22:57:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,144 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,936 KB
最終ジャッジ日時 2024-04-19 21:18:40
合計ジャッジ時間 38,336 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 573 ms
44,260 KB
testcase_01 AC 557 ms
44,664 KB
testcase_02 AC 558 ms
44,204 KB
testcase_03 AC 555 ms
44,216 KB
testcase_04 AC 569 ms
44,712 KB
testcase_05 AC 566 ms
44,344 KB
testcase_06 AC 584 ms
44,452 KB
testcase_07 AC 604 ms
44,716 KB
testcase_08 AC 612 ms
44,520 KB
testcase_09 AC 572 ms
44,500 KB
testcase_10 AC 599 ms
44,756 KB
testcase_11 AC 587 ms
44,760 KB
testcase_12 AC 586 ms
44,788 KB
testcase_13 AC 581 ms
44,372 KB
testcase_14 AC 573 ms
44,500 KB
testcase_15 AC 592 ms
44,792 KB
testcase_16 AC 583 ms
44,768 KB
testcase_17 AC 576 ms
44,656 KB
testcase_18 AC 522 ms
44,636 KB
testcase_19 AC 488 ms
44,728 KB
testcase_20 AC 569 ms
44,376 KB
testcase_21 AC 586 ms
44,376 KB
testcase_22 AC 600 ms
44,392 KB
testcase_23 AC 595 ms
44,516 KB
testcase_24 AC 614 ms
44,512 KB
testcase_25 AC 645 ms
44,904 KB
testcase_26 AC 607 ms
44,936 KB
testcase_27 AC 544 ms
44,720 KB
testcase_28 AC 764 ms
44,776 KB
testcase_29 AC 798 ms
44,500 KB
testcase_30 AC 724 ms
44,632 KB
testcase_31 AC 578 ms
44,788 KB
testcase_32 AC 880 ms
44,520 KB
testcase_33 AC 667 ms
44,388 KB
testcase_34 AC 771 ms
44,384 KB
testcase_35 AC 911 ms
44,644 KB
testcase_36 AC 880 ms
44,792 KB
testcase_37 AC 854 ms
44,376 KB
testcase_38 AC 780 ms
44,376 KB
testcase_39 AC 770 ms
44,624 KB
testcase_40 AC 897 ms
44,760 KB
testcase_41 AC 834 ms
44,248 KB
testcase_42 AC 868 ms
44,376 KB
testcase_43 AC 788 ms
44,656 KB
testcase_44 AC 729 ms
44,760 KB
testcase_45 AC 826 ms
44,504 KB
testcase_46 AC 1,142 ms
44,388 KB
testcase_47 AC 1,138 ms
44,516 KB
testcase_48 AC 1,144 ms
44,376 KB
testcase_49 AC 1,133 ms
44,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

MOD = 10**9 + 7

N, M, K = map(int, readline().split())
m = map(int, read().split())
PQC = tuple(zip(m, m, m))

dp = np.zeros((310, 310), np.int64)  # 最後の音、複雑度 -> 何通り
# 1音目
dp[1:301, 0] = 1
for _ in range(N - 1):
    newdp = np.zeros_like(dp)
    for p, q, c in PQC:
        newdp[q, c:310] += dp[p, 0:310 - c]
    dp = newdp % MOD

ans = dp[:, K].sum() % MOD
print(ans)
0