結果
問題 | No.2528 pop_(backfront or not) |
ユーザー | maksim |
提出日時 | 2023-11-03 21:34:01 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 784 bytes |
コンパイル時間 | 2,038 ms |
コンパイル使用メモリ | 167,604 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-11-03 21:34:04 |
合計ジャッジ時間 | 2,495 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | AC | 1 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 3 ms
4,348 KB |
testcase_09 | AC | 4 ms
4,348 KB |
testcase_10 | AC | 7 ms
4,348 KB |
testcase_11 | AC | 7 ms
4,348 KB |
testcase_12 | AC | 9 ms
4,348 KB |
testcase_13 | AC | 9 ms
4,348 KB |
testcase_14 | AC | 11 ms
4,348 KB |
testcase_15 | AC | 16 ms
4,348 KB |
testcase_16 | AC | 19 ms
4,348 KB |
testcase_17 | AC | 19 ms
4,348 KB |
testcase_18 | AC | 19 ms
4,348 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long const int p=998244353; const int maxn=4005; int res[maxn];int res2[maxn]; int32_t main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n;cin>>n;res[1]=1; for(int i=1;i<=n;++i) { fill(res2,res2+maxn,0); for(int j=1;j<=2*i+1;++j) { if(j!=1 && j!=(2*i+1)) {res2[j]+=res[j-1];} if(j!=1 && j!=(2*i+1)) { res2[j]+=res[j-1]*(j-2)*(2*i-j); } if(j!=1) res2[j]+=res[j-2]*((j-2)*(j-3)/2); if(j!=(2*i+1)) res2[j]+=res[j]*(2*i-j)*(2*i-j-1)/2; res2[j]%=p; } copy(res2,res2+maxn,res); } for(int i=1;i<=2*n+1;++i) cout<<res[i]<<'\n'; return 0; }