結果
問題 |
No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
|
ユーザー |
![]() |
提出日時 | 2024-09-19 23:44:46 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 386 ms / 2,000 ms |
コード長 | 297 bytes |
コンパイル時間 | 137 ms |
コンパイル使用メモリ | 82,416 KB |
実行使用メモリ | 77,720 KB |
最終ジャッジ日時 | 2024-09-19 23:44:51 |
合計ジャッジ時間 | 4,344 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
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: nq=[0]*(n+1) for i in range(n+1): nq[i]+=q[i]*(v-1) nq[i]%=M if i+1<=n: nq[i+1]+=q[i]*1 nq[i+1]%=M q=nq b=list(map(int,input().split())) for v in b: print(q[v])