結果
| 問題 |
No.2528 pop_(backfront or not)
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2023-11-03 22:31:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 156 ms / 2,000 ms |
| コード長 | 629 bytes |
| コンパイル時間 | 1,730 ms |
| コンパイル使用メモリ | 191,988 KB |
| 最終ジャッジ日時 | 2025-02-17 18:34:36 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
const int MOD=998244353;
int n;
ll dp[4040][4040];
ll f(ll x,ll y){
if(dp[x][y]) return dp[x][y];
if(x==0 || y==0) return dp[x][y]=0;
ll sum=0;
sum=(sum+f(x-1,y-1)*(x*y-x-y+2)%MOD)%MOD;
if(x>2) sum=(sum+f(x-2,y)*((x-1)*(x-2)/2)%MOD)%MOD;
if(y>2) sum=(sum+f(x,y-2)*((y-1)*(y-2)/2)%MOD)%MOD;
return dp[x][y]=sum;
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
dp[0][0]=1;
cin>>n;
rep(i,2*n+1) cout<<f(i,2*n-i)<<'\n';
return 0;
}
umezo