結果
問題 | No.1964 sum = length |
ユーザー |
![]() |
提出日時 | 2022-04-21 19:03:12 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,090 bytes |
コンパイル時間 | 2,977 ms |
コンパイル使用メモリ | 173,392 KB |
最終ジャッジ日時 | 2025-01-28 19:25:08 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 8 WA * 32 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>#include <deque>#include <queue>#include <string>#include <iomanip>#include <set>#include <unordered_set>#include <map>#include <unordered_map>#include <utility>#include <stdio.h>#include <math.h>#include <assert.h>#if __has_include(<atcoder/all>)#include <atcoder/all>using namespace atcoder;#endifusing namespace std;using ll=long long;#define read(x) cin>>(x);#define readll(x) ll (x);cin>>(x);#define readS(x) string (x);cin>>(x);#define readvll(x,N) vector<ll> (x)((N));for(int i=0;i<(N);i++){cin>>(x)[i];}int main(){int n;cin>>n;vector<ll> C(2*n);ll a=1;ll digit=0;while(a-digit<=2*n-1){C[a-digit]++;if(a%10==0){digit++;}a++;}const ll mod=998244353;vector<ll> dp(2*n);dp[0]=1;for(ll i=0;i<n;i++){vector<ll> dp2(2*n);for(ll j=0;j<2*n;j++){for(ll k=1;k<2*n;k++){if(j+k<2*n){dp2[j+k]+=dp[j]*C[k];dp2[j+k]%=mod;}}}dp.swap(dp2);}cout<<dp[2*n-1]<<endl;return 0;}