結果
| 問題 | No.1066 #いろいろな色 / Red and Blue and more various colors (Easy) |
| コンテスト | |
| ユーザー |
AEn
|
| 提出日時 | 2022-08-23 16:14:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 413 bytes |
| 記録 | |
| コンパイル時間 | 363 ms |
| コンパイル使用メモリ | 82,072 KB |
| 実行使用メモリ | 359,344 KB |
| 最終ジャッジ日時 | 2024-10-11 00:24:49 |
| 合計ジャッジ時間 | 6,558 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 MLE * 11 |
ソースコード
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)]
mod = 998244353
dp[0][0] = 1
for i in range(1, N+1):
for j in range(i+1):
dp[i][j] += dp[i-1][j]*(A[i-1]-1)
dp[i][j] %= mod
if j-1>=0:
dp[i][j] += dp[i-1][j-1]
dp[i][j] %= mod
for i in range(Q):
print(dp[-1][B[i]])
AEn