結果
| 問題 |
No.336 門松列列
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-05-05 16:01:38 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 511 ms / 2,000 ms |
| コード長 | 471 bytes |
| コンパイル時間 | 192 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 44,268 KB |
| 最終ジャッジ日時 | 2024-06-12 01:15:15 |
| 合計ジャッジ時間 | 9,493 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 8 |
ソースコード
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# N log N があるが N^2 で
MOD = 10**9 + 7
N = int(read())
dp = np.array([1], np.int64)
for n in range(2, N + 1):
newdp = np.zeros(n, np.int64)
if n & 1:
newdp[:-1] = np.cumsum(dp[::-1])[::-1]
else:
newdp[1:] = np.cumsum(dp)
dp = newdp % MOD
x = 2 * dp.sum() % MOD
if N <= 2:
x = 0
print(x)
maspy