結果
問題 |
No.1964 sum = length
|
ユーザー |
|
提出日時 | 2025-08-23 19:48:32 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,451 ms / 2,000 ms |
コード長 | 928 bytes |
コンパイル時間 | 4,607 ms |
コンパイル使用メモリ | 310,408 KB |
実行使用メモリ | 506,148 KB |
最終ジャッジ日時 | 2025-08-23 19:49:07 |
合計ジャッジ時間 | 29,496 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; mint dp[201][800][800]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N; cin >> N; dp[0][0][0] = 1; for(ll i = 0; i < N; i++) { for(ll j = 0; j <= 4 * i; j++) { for(ll k = 0; k < 5 * N / 2; k++) { if(dp[i][j][k] == 0) { continue; } for(ll nx = 1; k + nx < 4 * N; nx++) { ll nj = j; if(nx < 10) { nj += 2; } else if(nx < 100) { nj += 3; } else { nj += 4; } if(i == N - 1) { nj--; } if(nj < 4 * N) { dp[i + 1][nj][k + nx] += dp[i][j][k]; } } } } } mint ans = 0; for(ll i = 0; i < 4 * N; i++) { ans += dp[N][i][i]; } cout << ans.val() << "\n"; }