結果

問題 No.2528 pop_(backfront or not)
ユーザー umezoumezo
提出日時 2023-11-03 22:30:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 629 bytes
コンパイル時間 2,869 ms
コンパイル使用メモリ 201,340 KB
実行使用メモリ 35,612 KB
最終ジャッジ日時 2023-11-03 22:30:12
合計ジャッジ時間 9,043 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
4,468 KB
testcase_06 AC 3 ms
4,908 KB
testcase_07 AC 5 ms
6,384 KB
testcase_08 AC 7 ms
7,312 KB
testcase_09 AC 16 ms
12,560 KB
testcase_10 AC 42 ms
25,892 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
権限があれば一括ダウンロードができます

ソースコード

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[2020][2020];
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