結果

問題 No.1086 桁和の桁和2
ユーザー googol_S0googol_S0
提出日時 2020-06-19 22:10:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 681 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 115,120 KB
最終ジャッジ日時 2023-09-16 14:30:57
合計ジャッジ時間 10,312 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,504 KB
testcase_01 AC 69 ms
71,364 KB
testcase_02 AC 71 ms
71,048 KB
testcase_03 AC 70 ms
71,472 KB
testcase_04 AC 75 ms
71,480 KB
testcase_05 AC 135 ms
108,772 KB
testcase_06 AC 71 ms
71,304 KB
testcase_07 AC 72 ms
71,320 KB
testcase_08 AC 71 ms
71,372 KB
testcase_09 AC 70 ms
71,480 KB
testcase_10 AC 110 ms
92,304 KB
testcase_11 AC 79 ms
77,912 KB
testcase_12 AC 74 ms
75,688 KB
testcase_13 AC 121 ms
100,864 KB
testcase_14 AC 101 ms
90,680 KB
testcase_15 AC 131 ms
80,272 KB
testcase_16 AC 344 ms
108,876 KB
testcase_17 AC 110 ms
78,472 KB
testcase_18 WA -
testcase_19 AC 375 ms
112,444 KB
testcase_20 AC 122 ms
79,616 KB
testcase_21 AC 336 ms
108,812 KB
testcase_22 AC 428 ms
115,120 KB
testcase_23 AC 305 ms
104,432 KB
testcase_24 AC 239 ms
89,972 KB
testcase_25 AC 389 ms
114,624 KB
testcase_26 AC 335 ms
108,372 KB
testcase_27 AC 262 ms
94,960 KB
testcase_28 AC 228 ms
89,044 KB
testcase_29 WA -
testcase_30 AC 444 ms
114,056 KB
testcase_31 AC 445 ms
114,912 KB
testcase_32 WA -
testcase_33 AC 452 ms
114,704 KB
testcase_34 AC 447 ms
113,416 KB
testcase_35 AC 136 ms
108,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
L=list(map(int,input().split()))
R=list(map(int,input().split()))
D=list(map(int,input().split()))
for i in range(N-1):
  if D[i]!=0 and D[i+1]==0:
    print(0)
    exit()
DP=[[0]*9 for i in range(N+1)]
DP[0][0]=1
mod=10**9+7
X,Y=0,0
inv9=pow(9,mod-2,mod)
for i in range(N):
  if D[i]==0:
    DP[i+1][0]=1
    continue
  X=(pow(10,R[i]%(mod-1),mod)-1)*inv9%mod
  Y=(pow(10,L[i]%(mod-1),mod)-1)*inv9%mod
  for j in range(9):
    for k in range(9):
      DP[i+1][(j+k)%9]=(DP[i+1][(j+k)%9]+DP[i][j]*((0  if k else 1)+X-Y))%mod
  for j in range(9):
    if j!=D[i]%9:
      DP[i+1][j]=0
if set(D)=={0,9} or set(D)==set([9]):
  DP[N][0]=(DP[N][0]-1)%mod
print(sum(DP[N]))
0