結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー proribone
提出日時 2020-11-26 15:37:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,052 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,448 KB
最終ジャッジ日時 2024-07-23 20:51:47
合計ジャッジ時間 20,174 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
MOD=998244353
N,Q=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

f=np.zeros(N+1,np.int64)
f[0]=1

for A in a:
    ff=f*(A-1)
    ff[1:]+=f[:-1]
    ff%=MOD
    f=ff

for B in b:
    print(f[B])
0