結果
| 問題 |
No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
|
| コンテスト | |
| ユーザー |
tamato
|
| 提出日時 | 2020-05-29 21:42:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 622 bytes |
| コンパイル時間 | 835 ms |
| コンパイル使用メモリ | 82,692 KB |
| 実行使用メモリ | 359,356 KB |
| 最終ジャッジ日時 | 2024-11-06 03:13:04 |
| 合計ジャッジ時間 | 7,023 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 MLE * 11 |
ソースコード
mod = 998244353
eps = 10**-9
def main():
import sys
input = sys.stdin.readline
N, Q = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
dp = [[0] * (N+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
a = A[i]
for j in range(N+1):
if dp[i][j] == 0:
continue
dp[i+1][j] = (dp[i+1][j] + dp[i][j] * (a - 1))%mod
if j+1 <= N:
dp[i+1][j+1] = (dp[i+1][j+1] + dp[i][j])%mod
for b in B:
print(dp[-1][b])
if __name__ == '__main__':
main()
tamato