結果

問題 No.1964 sum = length
ユーザー rlangevinrlangevin
提出日時 2023-10-11 20:50:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,422 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 205,540 KB
最終ジャッジ日時 2023-10-11 20:50:58
合計ジャッジ時間 42,407 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
81,604 KB
testcase_01 AC 115 ms
80,968 KB
testcase_02 AC 286 ms
89,488 KB
testcase_03 AC 113 ms
81,104 KB
testcase_04 AC 146 ms
81,888 KB
testcase_05 AC 166 ms
85,856 KB
testcase_06 AC 176 ms
85,680 KB
testcase_07 AC 186 ms
85,876 KB
testcase_08 AC 192 ms
86,164 KB
testcase_09 AC 206 ms
85,976 KB
testcase_10 AC 209 ms
85,972 KB
testcase_11 AC 217 ms
85,888 KB
testcase_12 AC 492 ms
104,228 KB
testcase_13 AC 680 ms
114,984 KB
testcase_14 AC 839 ms
130,796 KB
testcase_15 AC 935 ms
136,120 KB
testcase_16 AC 280 ms
89,468 KB
testcase_17 AC 549 ms
109,548 KB
testcase_18 AC 601 ms
114,940 KB
testcase_19 AC 432 ms
99,208 KB
testcase_20 AC 465 ms
104,320 KB
testcase_21 AC 271 ms
89,196 KB
testcase_22 AC 1,707 ms
194,748 KB
testcase_23 AC 1,651 ms
189,148 KB
testcase_24 AC 1,266 ms
162,816 KB
testcase_25 AC 1,361 ms
168,032 KB
testcase_26 AC 1,778 ms
200,020 KB
testcase_27 AC 1,490 ms
178,452 KB
testcase_28 AC 1,332 ms
168,100 KB
testcase_29 AC 1,575 ms
184,096 KB
testcase_30 AC 1,374 ms
168,020 KB
testcase_31 AC 1,765 ms
199,940 KB
testcase_32 AC 1,001 ms
141,556 KB
testcase_33 AC 1,002 ms
141,440 KB
testcase_34 AC 1,653 ms
189,428 KB
testcase_35 AC 1,148 ms
152,216 KB
testcase_36 AC 1,432 ms
173,212 KB
testcase_37 AC 1,610 ms
183,988 KB
testcase_38 WA -
testcase_39 AC 1,345 ms
168,012 KB
testcase_40 AC 1,383 ms
167,824 KB
testcase_41 AC 1,730 ms
194,616 KB
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = 405
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
            # 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)
0