結果
問題 |
No.3043 括弧列の数え上げ
|
ユーザー |
|
提出日時 | 2025-02-28 23:07:42 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 617 bytes |
コンパイル時間 | 5,974 ms |
コンパイル使用メモリ | 333,128 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2025-02-28 23:07:49 |
合計ジャッジ時間 | 7,391 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 8 WA * 37 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include<atcoder/all> using mint = atcoder::modint998244353; using ld = long double; #define fi first #define se second #define all(x) x.begin(), x.end() #define rep(i,n) for(int i=0;i<(int)(n);++i) #define chmax(a,b) a=max(a,b) #define chmin(a,b) a=min(a,b) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; vector dp(N+1,vector<mint>(N+1,0)); rep(i,N){ rep(j,i+2){ if(j>0) dp[i+1][j-1]+=dp[i][j]+j-1; if(j<=i) dp[i+1][j+1]+=dp[i][j]; } } cout<<dp[N][N].val()<<"\n"; }