結果
| 問題 |
No.3043 括弧列の数え上げ
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-03-03 02:12:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 385 bytes |
| コンパイル時間 | 460 ms |
| コンパイル使用メモリ | 82,420 KB |
| 実行使用メモリ | 79,180 KB |
| 最終ジャッジ日時 | 2025-03-03 02:12:21 |
| 合計ジャッジ時間 | 7,003 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 37 |
ソースコード
import sys
input = sys.stdin.readline
N=int(input())
if N%2==1:
print(0)
exit()
x=N//2
DP=[0]*(x+1)
DP[0]=1
ANS=0
for i in range(N):
#print(DP,ANS)
NDP=[0]*(x+1)
for j in range(x+1):
if j+1<=x and j+1-(N-i-1)<=0:
NDP[j+1]+=DP[j]
if j-1>=0:
NDP[j-1]+=DP[j]
ANS+=(j-1)*DP[j]
DP=NDP
print(ANS%998244353)
titia