結果

問題 No.1964 sum = length
ユーザー rlangevinrlangevin
提出日時 2023-10-11 20:55:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,481 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 261,436 KB
最終ジャッジ日時 2023-10-11 20:55:58
合計ジャッジ時間 38,940 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
82,448 KB
testcase_01 AC 121 ms
81,688 KB
testcase_02 AC 333 ms
99,404 KB
testcase_03 AC 118 ms
82,004 KB
testcase_04 AC 153 ms
82,412 KB
testcase_05 AC 171 ms
87,420 KB
testcase_06 AC 182 ms
87,700 KB
testcase_07 AC 200 ms
87,428 KB
testcase_08 AC 202 ms
87,468 KB
testcase_09 AC 214 ms
87,464 KB
testcase_10 AC 222 ms
87,544 KB
testcase_11 AC 237 ms
93,304 KB
testcase_12 AC 599 ms
119,328 KB
testcase_13 AC 808 ms
137,916 KB
testcase_14 AC 1,014 ms
157,352 KB
testcase_15 AC 1,152 ms
171,336 KB
testcase_16 AC 311 ms
99,604 KB
testcase_17 AC 661 ms
125,844 KB
testcase_18 AC 706 ms
131,832 KB
testcase_19 AC 519 ms
111,616 KB
testcase_20 AC 539 ms
119,328 KB
testcase_21 AC 309 ms
93,228 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 AC 1,525 ms
203,012 KB
testcase_25 AC 1,674 ms
215,168 KB
testcase_26 TLE -
testcase_27 AC 1,818 ms
229,896 KB
testcase_28 AC 1,613 ms
208,956 KB
testcase_29 AC 1,944 ms
242,328 KB
testcase_30 AC 1,658 ms
215,496 KB
testcase_31 TLE -
testcase_32 AC 1,244 ms
177,820 KB
testcase_33 AC 1,218 ms
177,564 KB
testcase_34 TLE -
testcase_35 AC 1,418 ms
190,156 KB
testcase_36 AC 1,824 ms
223,176 KB
testcase_37 AC 1,966 ms
236,172 KB
testcase_38 TLE -
testcase_39 AC 1,685 ms
215,432 KB
testcase_40 AC 1,725 ms
215,800 KB
testcase_41 TLE -
testcase_42 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = 450
mod = 998244353
pre = [[0] * M for _ in range(M)]
pre[0][0] = 1
for _ in range(N):
    dp = [[0] * M for _ in range(M)]
    Ac = [[0] * M for _ in range(M)]
    for i in range(M):
        for j in range(M):
            if i + 1 <= M - 1 and j + 2 <= M - 1: 
                dp[i + 1][j + 2] += pre[i][j]
                dp[i + 1][j + 2] %= mod
            if i + 10 <= M - 1 and j + 2 <= M - 1: 
                dp[i + 10][j + 2] -= pre[i][j]
                dp[i + 10][j + 2] %= mod
            if i + 10 <= M - 1 and j + 3 <= M - 1: 
                dp[i + 10][j + 3] += pre[i][j]
                dp[i + 10][j + 3] %= mod
            if i + 100 <= M - 1 and j + 3 <= M - 1: 
                dp[i + 100][j + 3] -= pre[i][j]
                dp[i + 100][j + 3] %= mod
            if i + 100 <= M - 1 and j + 4 <= M - 1: 
                dp[i + 100][j + 4] += pre[i][j]
                dp[i + 100][j + 4] %= mod
            # dp[i + 405][j + 4] -= pre[i][j]
            # for n in range(1, M):
            #     num = len(str(n))
            #     if i + n <= M - 1 and j + num + 1 <= M - 1: 
            #         dp[i + n][j + num + 1] += pre[i][j]
            #         dp[i + n][j + num + 1] %= mod
    for i in range(1, M):
        for j in range(M):
            Ac[i][j] = (Ac[i - 1][j] + dp[i][j]) % mod
            
    Ac, pre = pre, Ac

ans = 0
for i in range(M - 1):
    ans += pre[i][i + 1]
    ans %= mod                

print(ans)
# print(pre)
0