結果

問題 No.1964 sum = length
ユーザー terasaterasa
提出日時 2022-06-03 22:58:19
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,201 bytes
コンパイル時間 1,003 ms
コンパイル使用メモリ 81,328 KB
実行使用メモリ 733,156 KB
最終ジャッジ日時 2023-10-21 02:16:08
合計ジャッジ時間 23,331 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,728 KB
testcase_01 AC 49 ms
60,860 KB
testcase_02 AC 135 ms
81,848 KB
testcase_03 AC 52 ms
60,860 KB
testcase_04 AC 72 ms
70,728 KB
testcase_05 AC 93 ms
76,020 KB
testcase_06 AC 96 ms
76,336 KB
testcase_07 AC 98 ms
76,548 KB
testcase_08 AC 98 ms
76,612 KB
testcase_09 AC 104 ms
76,856 KB
testcase_10 AC 106 ms
77,224 KB
testcase_11 AC 110 ms
77,432 KB
testcase_12 AC 282 ms
106,160 KB
testcase_13 AC 464 ms
138,796 KB
testcase_14 AC 753 ms
190,412 KB
testcase_15 AC 927 ms
222,812 KB
testcase_16 AC 128 ms
81,292 KB
testcase_17 AC 330 ms
115,476 KB
testcase_18 AC 389 ms
125,436 KB
testcase_19 AC 235 ms
97,524 KB
testcase_20 AC 247 ms
101,312 KB
testcase_21 AC 130 ms
80,848 KB
testcase_22 MLE -
testcase_23 MLE -
testcase_24 RE -
testcase_25 RE -
testcase_26 MLE -
testcase_27 RE -
testcase_28 RE -
testcase_29 MLE -
testcase_30 RE -
testcase_31 MLE -
testcase_32 AC 1,139 ms
255,396 KB
testcase_33 AC 1,059 ms
245,032 KB
testcase_34 MLE -
testcase_35 AC 1,394 ms
302,844 KB
testcase_36 RE -
testcase_37 MLE -
testcase_38 MLE -
testcase_39 RE -
testcase_40 RE -
testcase_41 MLE -
testcase_42 MLE -
権限があれば一括ダウンロードができます

ソースコード

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(510)] for _ in range(2 * N)] for _ in range(N + 1)]
S = [[[0 for _ in range(510)] for _ in range(2 * N)] for _ in range(N + 1)]
dp[0][0][0] = 1
for k in range(4 * 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, 510):
            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(510):
        if j + N - 1 == k:
            ans += dp[N][j][k]
            ans %= mod
print(ans)
0