結果
問題 | No.2528 pop_(backfront or not) |
ユーザー |
![]() |
提出日時 | 2023-11-03 22:50:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,499 ms / 2,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 422 ms |
コンパイル使用メモリ | 82,252 KB |
実行使用メモリ | 263,884 KB |
最終ジャッジ日時 | 2024-09-25 21:13:36 |
合計ジャッジ時間 | 12,174 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) mod=998244353 N=int(input()) LIST=[[-1]*4200 for i in range(4200)] def calc(x,y): if y>(x+1)//2: y=x-y+1 if y==1 or y==x: return 0 if x==3: if y==2: return 1 else: return 0 if LIST[x][y]!=-1: return LIST[x][y] LIST[x][y]=((y-2)*(y-3)//2*calc(x-2,y-2)+((y-2)*(x-y-1)+1)*calc(x-2,y-1)+(x-y-1)*(x-y-2)//2*calc(x-2,y))%mod return LIST[x][y] for i in range(3,N*2+1,2): for j in range(1,i): calc(i,j) ANS=[] for i in range(1,N*2+2): ANS.append(calc(N*2+1,i)) print("\n".join(map(str,ANS)))