結果
| 問題 | No.1066 #いろいろな色 / Red and Blue and more various colors (Easy) | 
| コンテスト | |
| ユーザー |  Kiri8128 | 
| 提出日時 | 2020-05-30 00:35:29 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 217 ms / 2,000 ms | 
| コード長 | 341 bytes | 
| コンパイル時間 | 245 ms | 
| コンパイル使用メモリ | 82,344 KB | 
| 実行使用メモリ | 76,704 KB | 
| 最終ジャッジ日時 | 2024-11-06 10:01:41 | 
| 合計ジャッジ時間 | 3,701 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
N, Q = map(int, input().split())
P = 998244353
A = [int(a) - 1 for a in input().split()]
preX = [1]
for i in range(N):
    X = [0] * (i + 2)
    for j in range(i+1):
        X[j] += preX[j] * A[i]
        X[j+1] += preX[j]
        X[j] %= P
        X[j+1] %= P
    preX = X
B = [int(a) for a in input().split()]
for a in B:
    print(X[a])
            
            
            
        