結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー sasa8uyauya
提出日時 2024-09-19 23:43:03
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 309 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 69,472 KB
最終ジャッジ日時 2024-09-19 23:43:09
合計ジャッジ時間 2,921 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q=map(int,input().split())
a=list(map(int,input().split()))
q=[0]*(n+1)
q[0]=1
for v in a:
  iv=pow(v,M-2,M)
  nq=[0]*(n+1)
  for i in range(n+1):
    nq[i]+=q[i]*(v-1)*iv
    nq[i]%=M
    if i+1<=n:
      nq[i+1]+=q[i]*1*iv
      nq[i+1]%=M
  q=nq
b=list(map(int,input().split()))
for v in b:
  print(q[v])
0