結果

問題 No.1086 桁和の桁和2
ユーザー shotoyooshotoyoo
提出日時 2021-06-19 14:01:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 448 ms / 3,000 ms
コード長 754 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 109,952 KB
最終ジャッジ日時 2023-09-05 00:48:06
合計ジャッジ時間 11,521 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,644 KB
testcase_01 AC 68 ms
71,472 KB
testcase_02 AC 70 ms
71,388 KB
testcase_03 AC 70 ms
71,444 KB
testcase_04 AC 69 ms
71,572 KB
testcase_05 AC 448 ms
109,756 KB
testcase_06 AC 67 ms
71,284 KB
testcase_07 AC 70 ms
71,552 KB
testcase_08 AC 68 ms
71,184 KB
testcase_09 AC 67 ms
71,372 KB
testcase_10 AC 309 ms
93,572 KB
testcase_11 AC 138 ms
79,092 KB
testcase_12 AC 87 ms
76,800 KB
testcase_13 AC 369 ms
101,988 KB
testcase_14 AC 260 ms
92,124 KB
testcase_15 AC 120 ms
77,736 KB
testcase_16 AC 334 ms
95,480 KB
testcase_17 AC 97 ms
76,736 KB
testcase_18 AC 434 ms
109,068 KB
testcase_19 AC 367 ms
102,072 KB
testcase_20 AC 111 ms
77,628 KB
testcase_21 AC 327 ms
95,596 KB
testcase_22 AC 434 ms
109,532 KB
testcase_23 AC 290 ms
93,592 KB
testcase_24 AC 232 ms
89,792 KB
testcase_25 AC 376 ms
104,880 KB
testcase_26 AC 315 ms
95,292 KB
testcase_27 AC 251 ms
91,844 KB
testcase_28 AC 222 ms
88,628 KB
testcase_29 AC 252 ms
90,192 KB
testcase_30 AC 442 ms
108,892 KB
testcase_31 AC 448 ms
109,764 KB
testcase_32 AC 440 ms
109,952 KB
testcase_33 AC 437 ms
109,556 KB
testcase_34 AC 439 ms
108,892 KB
testcase_35 AC 443 ms
109,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))

M = 10**9+7
n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
d = list(map(int, input().split()))
ans = 1
prv = 0
inv9 = pow(9, M-2, M)
zero = 1
for i in range(n):
    dd = d[i] - prv
    prv = d[i]
    v = (pow(10, r[i], M) - pow(10, l[i], M)) * inv9 % M
    if d[i]!=0:
        zero = 0
    if d[i]==0 and not zero:
        ans = 0
    if dd==0:
        if zero:
            val = 1
        else:
            val = 1 + v
    else:
        val = v
    ans *= val
    ans %= M
print(ans%M)
0