結果

問題 No.1964 sum = length
ユーザー terasaterasa
提出日時 2022-06-03 22:29:31
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,768 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,556 KB
実行使用メモリ 639,628 KB
最終ジャッジ日時 2023-10-21 02:03:05
合計ジャッジ時間 12,281 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 289 ms
116,584 KB
testcase_01 AC 179 ms
102,644 KB
testcase_02 AC 1,537 ms
311,176 KB
testcase_03 AC 176 ms
102,644 KB
testcase_04 AC 291 ms
116,584 KB
testcase_05 AC 384 ms
129,424 KB
testcase_06 AC 477 ms
142,580 KB
testcase_07 AC 550 ms
155,664 KB
testcase_08 AC 624 ms
168,688 KB
testcase_09 AC 699 ms
181,680 KB
testcase_10 AC 796 ms
194,456 KB
testcase_11 AC 861 ms
207,312 KB
testcase_12 MLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
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')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


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

dp = [[[0 for _ in range(2010)] for _ in range(410)] for _ in range(N + 1)]
S = [[[0 for _ in range(2010)] for _ in range(410)] for _ in range(N + 1)]
dp[0][0][0] = 1
for k in range(2010):
    S[0][0][k] = 1

for i in range(1, N + 1):
    for j in range(1, 400):
        for k in range(1, 2000):
            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] - (S[i - 1][j - 3][k - 1000] if k >= 1000 else 0)
            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(400):
    for k in range(2000):
        if j + N - 1 == k:
            ans += dp[N][j][k]
            ans %= mod
print(ans)
0