結果
| 問題 |
No.1111 コード進行
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-07-10 22:57:38 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,096 ms / 2,000 ms |
| コード長 | 533 bytes |
| コンパイル時間 | 530 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 44,892 KB |
| 最終ジャッジ日時 | 2024-10-11 13:38:45 |
| 合計ジャッジ時間 | 35,285 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 48 |
ソースコード
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)
maspy