結果

問題 No.1086 桁和の桁和2
ユーザー wolgnikwolgnik
提出日時 2020-06-19 23:22:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 626 ms / 3,000 ms
コード長 687 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 108,832 KB
最終ジャッジ日時 2023-09-29 23:54:46
合計ジャッジ時間 13,411 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,624 KB
testcase_01 AC 95 ms
71,564 KB
testcase_02 AC 94 ms
71,688 KB
testcase_03 AC 94 ms
71,724 KB
testcase_04 AC 97 ms
71,712 KB
testcase_05 AC 159 ms
107,808 KB
testcase_06 AC 95 ms
71,516 KB
testcase_07 AC 95 ms
71,552 KB
testcase_08 AC 94 ms
71,644 KB
testcase_09 AC 92 ms
71,900 KB
testcase_10 AC 134 ms
100,140 KB
testcase_11 AC 103 ms
78,456 KB
testcase_12 AC 98 ms
77,024 KB
testcase_13 AC 142 ms
100,816 KB
testcase_14 AC 124 ms
95,644 KB
testcase_15 AC 169 ms
78,168 KB
testcase_16 AC 460 ms
99,700 KB
testcase_17 AC 141 ms
78,064 KB
testcase_18 AC 608 ms
108,264 KB
testcase_19 AC 512 ms
100,960 KB
testcase_20 AC 161 ms
78,160 KB
testcase_21 AC 456 ms
100,988 KB
testcase_22 AC 606 ms
108,284 KB
testcase_23 AC 409 ms
101,760 KB
testcase_24 AC 321 ms
93,288 KB
testcase_25 AC 522 ms
103,476 KB
testcase_26 AC 451 ms
101,124 KB
testcase_27 AC 360 ms
96,184 KB
testcase_28 AC 318 ms
90,832 KB
testcase_29 AC 338 ms
93,716 KB
testcase_30 AC 619 ms
108,604 KB
testcase_31 AC 618 ms
108,632 KB
testcase_32 AC 618 ms
108,740 KB
testcase_33 AC 618 ms
108,832 KB
testcase_34 AC 626 ms
108,532 KB
testcase_35 AC 163 ms
107,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(input())
ls = list(map(int, input().split()))
rs = list(map(int, input().split()))
ds = list(map(int, input().split()))
mod = 10 ** 9 + 7

d = [0] * N
d[0] = ds[0]
for i in range(N - 1):
  d[i + 1] = ds[i + 1] - ds[i]
  if ds[i] > 0 and (ds[i + 1] == 0):
    print(0)
    exit(0)
#print(d)
res = 1
zero = ds[0] == 0
for i in range(N):
  if (ds[i] == 0) and zero:
    continue
  else: zero = 1
  l = ls[i]
  r = rs[i]
  
  t = (pow(10, r, mod) - 1) * pow(9, mod - 2, mod) % mod
  if l: t -= (pow(10, l, mod) - 1) * pow(9, mod - 2, mod) % mod
  res *= t + (d[i] == 0) * (i > 0)
  res %= mod
print(res)
0