結果
問題 | No.189 SUPER HAPPY DAY |
ユーザー | mkawa2 |
提出日時 | 2020-01-27 23:04:07 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 2,361 ms / 5,000 ms |
コード長 | 1,831 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 10,932 KB |
実行使用メモリ | 60,120 KB |
最終ジャッジ日時 | 2023-10-12 18:04:19 |
合計ジャッジ時間 | 14,311 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 19 ms
8,404 KB |
testcase_01 | AC | 22 ms
8,772 KB |
testcase_02 | AC | 18 ms
8,340 KB |
testcase_03 | AC | 22 ms
8,492 KB |
testcase_04 | AC | 22 ms
8,584 KB |
testcase_05 | AC | 22 ms
8,660 KB |
testcase_06 | AC | 22 ms
8,652 KB |
testcase_07 | AC | 22 ms
8,620 KB |
testcase_08 | AC | 22 ms
8,632 KB |
testcase_09 | AC | 22 ms
8,732 KB |
testcase_10 | AC | 22 ms
8,648 KB |
testcase_11 | AC | 22 ms
8,512 KB |
testcase_12 | AC | 21 ms
8,544 KB |
testcase_13 | AC | 610 ms
22,744 KB |
testcase_14 | AC | 853 ms
28,308 KB |
testcase_15 | AC | 960 ms
29,664 KB |
testcase_16 | AC | 1,148 ms
33,848 KB |
testcase_17 | AC | 1,180 ms
34,656 KB |
testcase_18 | AC | 907 ms
28,468 KB |
testcase_19 | AC | 1,268 ms
36,832 KB |
testcase_20 | AC | 340 ms
16,356 KB |
testcase_21 | AC | 303 ms
15,900 KB |
testcase_22 | AC | 40 ms
9,292 KB |
testcase_23 | AC | 1,179 ms
34,172 KB |
testcase_24 | AC | 1,183 ms
34,312 KB |
testcase_25 | AC | 2,361 ms
60,120 KB |
ソースコード
class mint: def __init__(self, x): self.__x = x % md def __str__(self): return str(self.__x) def __add__(self, other): if isinstance(other, mint): other = other.__x return mint(self.__x + other) def __sub__(self, other): if isinstance(other, mint): other = other.__x return mint(self.__x - other) def __rsub__(self, other): return mint(other - self.__x) def __mul__(self, other): if isinstance(other, mint): other = other.__x return mint(self.__x * other) __radd__ = __add__ __rmul__ = __mul__ def __truediv__(self, other): if isinstance(other, mint): other = other.__x return mint(self.__x * pow(other, md - 2, md)) def __pow__(self, power, modulo=None): return mint(pow(self.__x, power, md)) md = 10 ** 9 + 9 def main(): m, d = input().split() m = [int(c) for c in m] d = [int(c) for c in d] dpm = [[0 for _ in range(1801)] for _ in range(len(m) + 1)] dpd = [[0 for _ in range(1801)] for _ in range(len(d) + 1)] border = 0 for i, a in enumerate(m): for s in range(1801): pre = dpm[i][s] if pre == 0: continue for na in range(10): dpm[i + 1][s + na] += pre for na in range(a): dpm[i + 1][border + na] += mint(1) border += a dpm[-1][border] += 1 border = 0 for i, a in enumerate(d): for s in range(1801): pre = dpd[i][s] if pre == 0: continue for na in range(10): dpd[i + 1][s + na] += pre for na in range(a): dpd[i + 1][border + na] += mint(1) border += a dpd[-1][border] += 1 ans = sum(dpm[-1][i] * dpd[-1][i] for i in range(1, 1801)) print(ans) main()