結果

問題 No.2528 pop_(backfront or not)
ユーザー umezoumezo
提出日時 2023-11-03 22:31:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 1,755 ms
コンパイル使用メモリ 201,152 KB
実行使用メモリ 83,112 KB
最終ジャッジ日時 2023-11-03 22:31:15
合計ジャッジ時間 3,409 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,536 KB
testcase_01 AC 1 ms
5,544 KB
testcase_02 AC 2 ms
5,552 KB
testcase_03 AC 2 ms
5,568 KB
testcase_04 AC 2 ms
5,608 KB
testcase_05 AC 3 ms
6,468 KB
testcase_06 AC 4 ms
6,928 KB
testcase_07 AC 7 ms
8,392 KB
testcase_08 AC 8 ms
9,320 KB
testcase_09 AC 19 ms
14,552 KB
testcase_10 AC 49 ms
28,728 KB
testcase_11 AC 51 ms
30,276 KB
testcase_12 AC 65 ms
39,332 KB
testcase_13 AC 70 ms
42,308 KB
testcase_14 AC 87 ms
49,680 KB
testcase_15 AC 134 ms
70,756 KB
testcase_16 AC 180 ms
83,016 KB
testcase_17 AC 160 ms
83,064 KB
testcase_18 AC 161 ms
83,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0