結果
問題 |
No.1964 sum = length
|
ユーザー |
|
提出日時 | 2025-08-23 19:44:04 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 834 bytes |
コンパイル時間 | 3,099 ms |
コンパイル使用メモリ | 278,384 KB |
実行使用メモリ | 506,176 KB |
最終ジャッジ日時 | 2025-08-23 19:44:38 |
合計ジャッジ時間 | 30,075 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 TLE * 1 |
ソースコード
#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 < 3 * N; 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"; }