結果

問題 No.1964 sum = length
ユーザー terasaterasa
提出日時 2022-06-03 22:33:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,763 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 81,628 KB
実行使用メモリ 421,972 KB
最終ジャッジ日時 2023-10-21 02:07:36
合計ジャッジ時間 43,437 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
82,164 KB
testcase_01 AC 92 ms
79,512 KB
testcase_02 AC 291 ms
107,904 KB
testcase_03 AC 91 ms
79,508 KB
testcase_04 AC 119 ms
82,160 KB
testcase_05 AC 139 ms
83,728 KB
testcase_06 AC 152 ms
85,608 KB
testcase_07 AC 166 ms
87,288 KB
testcase_08 AC 181 ms
88,988 KB
testcase_09 AC 191 ms
90,664 KB
testcase_10 AC 195 ms
92,500 KB
testcase_11 AC 206 ms
94,644 KB
testcase_12 AC 522 ms
150,612 KB
testcase_13 AC 705 ms
183,544 KB
testcase_14 AC 903 ms
221,124 KB
testcase_15 AC 1,006 ms
239,964 KB
testcase_16 AC 269 ms
106,052 KB
testcase_17 AC 578 ms
161,232 KB
testcase_18 AC 630 ms
171,300 KB
testcase_19 AC 455 ms
138,836 KB
testcase_20 AC 493 ms
144,300 KB
testcase_21 AC 264 ms
104,548 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 1,346 ms
303,788 KB
testcase_25 AC 1,466 ms
324,420 KB
testcase_26 WA -
testcase_27 AC 1,628 ms
350,624 KB
testcase_28 AC 1,428 ms
317,912 KB
testcase_29 AC 1,763 ms
371,012 KB
testcase_30 AC 1,468 ms
326,084 KB
testcase_31 WA -
testcase_32 AC 1,090 ms
257,544 KB
testcase_33 AC 1,064 ms
251,772 KB
testcase_34 WA -
testcase_35 AC 1,233 ms
280,228 KB
testcase_36 AC 1,523 ms
336,344 KB
testcase_37 AC 1,754 ms
367,628 KB
testcase_38 TLE -
testcase_39 AC 1,455 ms
321,288 KB
testcase_40 AC 1,483 ms
327,832 KB
testcase_41 WA -
testcase_42 TLE -
権限があれば一括ダウンロードができます

ソースコード

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

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