結果

問題 No.2528 pop_(backfront or not)
ユーザー umezoumezo
提出日時 2023-11-03 22:26:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 639 bytes
コンパイル時間 2,105 ms
コンパイル使用メモリ 210,252 KB
実行使用メモリ 167,432 KB
最終ジャッジ日時 2023-11-03 22:27:08
合計ジャッジ時間 14,482 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 7 ms
4,348 KB
testcase_06 AC 13 ms
4,736 KB
testcase_07 AC 46 ms
7,280 KB
testcase_08 AC 73 ms
9,188 KB
testcase_09 AC 279 ms
22,292 KB
testcase_10 AC 1,052 ms
64,896 KB
testcase_11 AC 1,121 ms
69,820 KB
testcase_12 AC 1,720 ms
99,456 KB
testcase_13 AC 1,904 ms
109,296 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

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;
map<pair<ll,ll>,ll> m;
ll f(ll x,ll y){
  if(m.count({x,y})) return m[{x,y}];
  if(x<=0 || y<=0) return m[{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 m[{x,y}]=sum;
}
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  m[{0,0}]=1;
  cin>>n;
  rep(i,2*n+1) cout<<f(i,2*n-i)<<'\n';
    
  return 0;
}
0