結果

問題 No.1086 桁和の桁和2
ユーザー wolgnik
提出日時 2020-06-19 23:21:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 686 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 108,144 KB
最終ジャッジ日時 2024-07-03 15:45:19
合計ジャッジ時間 9,621 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4 WA * 1
other AC * 10 WA * 21
権限があれば一括ダウンロードができます

ソースコード

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 (d[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