結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
91,328 KB
testcase_01 AC 107 ms
82,648 KB
testcase_02 AC 480 ms
138,072 KB
testcase_03 AC 106 ms
82,652 KB
testcase_04 AC 155 ms
86,984 KB
testcase_05 AC 181 ms
90,336 KB
testcase_06 AC 207 ms
94,336 KB
testcase_07 AC 230 ms
97,688 KB
testcase_08 AC 255 ms
100,984 KB
testcase_09 AC 271 ms
104,184 KB
testcase_10 AC 289 ms
107,328 KB
testcase_11 AC 308 ms
110,608 KB
testcase_12 AC 989 ms
221,816 KB
testcase_13 AC 1,404 ms
285,624 KB
testcase_14 AC 1,838 ms
359,848 KB
testcase_15 TLE -
testcase_16 AC 456 ms
134,088 KB
testcase_17 AC 1,106 ms
241,992 KB
testcase_18 AC 1,232 ms
261,580 KB
testcase_19 AC 851 ms
198,244 KB
testcase_20 AC 904 ms
208,328 KB
testcase_21 AC 432 ms
130,640 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')


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(1010)] for _ in range(210)] for _ in range(N + 1)]
S = [[[0 for _ in range(1010)] for _ in range(210)] for _ in range(N + 1)]
dp[0][0][0] = 1
for k in range(1010):
    S[0][0][k] = 1

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