結果
| 問題 |
No.1964 sum = length
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-23 19:46:51 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 837 bytes |
| コンパイル時間 | 3,152 ms |
| コンパイル使用メモリ | 278,352 KB |
| 実行使用メモリ | 506,040 KB |
| 最終ジャッジ日時 | 2025-08-23 19:47:25 |
| 合計ジャッジ時間 | 29,752 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 < 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";
}