結果

問題 No.336 門松列列
ユーザー maspy
提出日時 2020-05-05 16:01:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 444 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,580 KB
最終ジャッジ日時 2024-06-26 11:23:28
合計ジャッジ時間 11,202 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 7 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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

print(2 * dp.sum() % MOD)
0