結果

問題 No.189 SUPER HAPPY DAY
ユーザー rlangevinrlangevin
提出日時 2023-09-05 00:03:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 476 ms / 5,000 ms
コード長 819 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 89,112 KB
最終ジャッジ日時 2023-09-05 00:03:49
合計ジャッジ時間 7,092 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
76,740 KB
testcase_01 AC 88 ms
76,804 KB
testcase_02 AC 83 ms
76,368 KB
testcase_03 AC 89 ms
76,692 KB
testcase_04 AC 86 ms
76,872 KB
testcase_05 AC 85 ms
76,400 KB
testcase_06 AC 87 ms
76,828 KB
testcase_07 AC 87 ms
76,572 KB
testcase_08 AC 86 ms
76,796 KB
testcase_09 AC 93 ms
76,756 KB
testcase_10 AC 86 ms
76,392 KB
testcase_11 AC 89 ms
76,736 KB
testcase_12 AC 85 ms
76,812 KB
testcase_13 AC 259 ms
79,992 KB
testcase_14 AC 307 ms
80,936 KB
testcase_15 AC 314 ms
81,736 KB
testcase_16 AC 316 ms
82,516 KB
testcase_17 AC 335 ms
82,908 KB
testcase_18 AC 285 ms
81,400 KB
testcase_19 AC 400 ms
83,564 KB
testcase_20 AC 195 ms
78,708 KB
testcase_21 AC 208 ms
78,472 KB
testcase_22 AC 109 ms
77,488 KB
testcase_23 AC 282 ms
82,308 KB
testcase_24 AC 307 ms
81,996 KB
testcase_25 AC 476 ms
89,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = 2000


def f(S):
    pre0 = [0] * N
    pre1 = [0] * N
    pre0[0] = 1
    for s in S:
        dp0 = [0] * N
        dp1 = [0] * N
        for i in range(N):
            for j in range(10):
                if j == s:
                    if i - j >= 0:
                        dp0[i] += pre0[i - j]
                elif j < s:
                    if i - j >= 0:
                        dp1[i] += pre0[i - j]
                if i - j >= 0:
                    dp1[i] += pre1[i - j]
        dp0, pre0 = pre0, dp0
        dp1, pre1 = pre1, dp1

    L = [0] * N
    for i in range(N):
        L[i] = pre0[i] + pre1[i]

    return L


M, D = input().split()
M = [int(m) for m in M]
D = [int(d) for d in D]
ans = -1
mod = 10**9 + 9
A, B = f(M), f(D)
for i in range(N):
    ans += A[i] * B[i]
    ans %= mod

print(ans%mod)
0