結果
問題 | No.189 SUPER HAPPY DAY |
ユーザー | mkawa2 |
提出日時 | 2020-01-27 22:35:57 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 3,265 ms / 5,000 ms |
コード長 | 2,505 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 113,920 KB |
最終ジャッジ日時 | 2024-09-14 16:23:22 |
合計ジャッジ時間 | 19,470 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
11,392 KB |
testcase_01 | AC | 56 ms
13,184 KB |
testcase_02 | AC | 37 ms
11,392 KB |
testcase_03 | AC | 50 ms
12,800 KB |
testcase_04 | AC | 49 ms
12,928 KB |
testcase_05 | AC | 52 ms
13,056 KB |
testcase_06 | AC | 49 ms
12,928 KB |
testcase_07 | AC | 51 ms
12,928 KB |
testcase_08 | AC | 49 ms
12,800 KB |
testcase_09 | AC | 53 ms
12,928 KB |
testcase_10 | AC | 51 ms
12,928 KB |
testcase_11 | AC | 51 ms
12,928 KB |
testcase_12 | AC | 50 ms
13,056 KB |
testcase_13 | AC | 938 ms
50,944 KB |
testcase_14 | AC | 1,284 ms
62,720 KB |
testcase_15 | AC | 1,368 ms
58,752 KB |
testcase_16 | AC | 1,595 ms
63,616 KB |
testcase_17 | AC | 1,689 ms
69,504 KB |
testcase_18 | AC | 1,318 ms
56,832 KB |
testcase_19 | AC | 1,821 ms
77,440 KB |
testcase_20 | AC | 524 ms
34,048 KB |
testcase_21 | AC | 516 ms
36,608 KB |
testcase_22 | AC | 91 ms
16,640 KB |
testcase_23 | AC | 1,611 ms
62,720 KB |
testcase_24 | AC | 1,620 ms
62,592 KB |
testcase_25 | AC | 3,265 ms
113,920 KB |
ソースコード
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] 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] * 2 for _ in range(1801)] for _ in range(len(m) + 1)] dpd = [[[0] * 2 for _ in range(1801)] for _ in range(len(d) + 1)] dpm[0][0][0] = mint(1) dpd[0][0][0] = mint(1) for i, a in enumerate(m): for s in range(1801): for f in range(2): pre = dpm[i][s][f] if pre == 0: continue if f: for na in range(10): dpm[i + 1][s + na][1] += pre else: for na in range(a): dpm[i + 1][s + na][1] += pre dpm[i + 1][s + a][0] += pre for i, a in enumerate(d): for s in range(1801): for f in range(2): pre = dpd[i][s][f] if pre == 0: continue if f: for na in range(10): dpd[i + 1][s + na][1] += pre else: for na in range(a): dpd[i + 1][s + na][1] += pre dpd[i + 1][s + a][0] += pre ans = sum(sum(dpm[-1][i]) * sum(dpd[-1][i]) for i in range(1, 1801)) print(ans) main()