結果
| 問題 | 
                            No.1964 sum = length
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-08-23 19:36:45 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 843 bytes | 
| コンパイル時間 | 2,640 ms | 
| コンパイル使用メモリ | 278,500 KB | 
| 実行使用メモリ | 506,112 KB | 
| 最終ジャッジ日時 | 2025-08-23 19:37:18 | 
| 合計ジャッジ時間 | 32,507 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 34 TLE * 6 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  mint dp[N + 1][4 * N][4 * N]{};
  dp[0][0][0] = 1;
  for(ll i = 0; i < N; i++) {
    for(ll j = 0; j < 4 * N; j++) {
      for(ll k = 0; k < 4 * 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";
}