結果
| 問題 | No.1066 #いろいろな色 / Red and Blue and more various colors (Easy) |
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2024-09-19 23:43:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 321 bytes |
| 記録 | |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 81,960 KB |
| 実行使用メモリ | 157,580 KB |
| 最終ジャッジ日時 | 2024-09-19 23:43:37 |
| 合計ジャッジ時間 | 5,434 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 7 MLE * 1 -- * 16 |
ソースコード
n,q=map(int,input().split())
M=998244353
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])
sasa8uyauya