結果

問題 No.336 門松列列
ユーザー maspymaspy
提出日時 2020-05-05 16:01:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 444 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 10,672 KB
実行使用メモリ 29,912 KB
最終ジャッジ日時 2023-09-08 18:32:09
合計ジャッジ時間 5,508 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 170 ms
29,744 KB
testcase_01 WA -
testcase_02 AC 130 ms
29,704 KB
testcase_03 AC 130 ms
29,508 KB
testcase_04 AC 180 ms
29,760 KB
testcase_05 WA -
testcase_06 AC 140 ms
29,804 KB
testcase_07 AC 152 ms
29,752 KB
testcase_08 AC 163 ms
29,688 KB
testcase_09 AC 175 ms
29,724 KB
testcase_10 AC 179 ms
29,912 KB
testcase_11 AC 178 ms
29,788 KB
権限があれば一括ダウンロードができます

ソースコード

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