結果

問題 No.1964 sum = length
ユーザー terasaterasa
提出日時 2022-06-03 22:53:18
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,214 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 81,548 KB
実行使用メモリ 831,128 KB
最終ジャッジ日時 2023-10-21 02:14:42
合計ジャッジ時間 8,661 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,552 KB
testcase_01 AC 42 ms
55,552 KB
testcase_02 AC 104 ms
78,612 KB
testcase_03 AC 39 ms
55,552 KB
testcase_04 AC 39 ms
55,552 KB
testcase_05 AC 41 ms
55,552 KB
testcase_06 AC 50 ms
64,004 KB
testcase_07 AC 54 ms
66,044 KB
testcase_08 AC 61 ms
68,176 KB
testcase_09 AC 60 ms
70,768 KB
testcase_10 AC 69 ms
73,628 KB
testcase_11 AC 73 ms
72,932 KB
testcase_12 AC 222 ms
101,648 KB
testcase_13 AC 494 ms
150,256 KB
testcase_14 AC 1,058 ms
260,672 KB
testcase_15 AC 1,453 ms
343,128 KB
testcase_16 AC 105 ms
78,316 KB
testcase_17 AC 287 ms
112,936 KB
testcase_18 AC 373 ms
127,984 KB
testcase_19 AC 171 ms
90,948 KB
testcase_20 AC 195 ms
95,288 KB
testcase_21 AC 103 ms
78,164 KB
testcase_22 MLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# pypyjit.set_param('max_unroll_recursion=-1')


N = int(input())
mod = 998_244_353

dp = [[[0 for _ in range(10 * N)] for _ in range(2 * N)] for _ in range(N + 1)]
S = [[[0 for _ in range(10 * N)] for _ in range(2 * N)] for _ in range(N + 1)]
dp[0][0][0] = 1
for k in range(10 * N):
    S[0][0][k] = 1

for i in range(1, N + 1):
    for j in range(1, 2 * N):
        for k in range(1, 10 * N):
            if j >= 1 and k >= 1:
                dp[i][j][k] += S[i - 1][j - 1][k - 1] - (S[i - 1][j - 1][k - 10] if k >= 10 else 0)
            if j >= 2 and k >= 10:
                dp[i][j][k] += S[i - 1][j - 2][k - 10] - (S[i - 1][j - 2][k - 100] if k >= 100 else 0)
            if j >= 3 and k >= 100:
                dp[i][j][k] += S[i - 1][j - 3][k - 100]
            dp[i][j][k] %= mod

            S[i][j][k] += S[i][j][k - 1] + dp[i][j][k]
            S[i][j][k] %= mod

ans = 0
for j in range(2 * N):
    for k in range(10 * N):
        if j + N - 1 == k:
            ans += dp[N][j][k]
            ans %= mod
print(ans)
0