結果
| 問題 | No.1066 #いろいろな色 / Red and Blue and more various colors (Easy) |
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 22:14:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 560 bytes |
| 記録 | |
| コンパイル時間 | 308 ms |
| コンパイル使用メモリ | 81,680 KB |
| 実行使用メモリ | 66,104 KB |
| 最終ジャッジ日時 | 2025-04-15 22:15:43 |
| 合計ジャッジ時間 | 3,506 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 24 |
ソースコード
MOD = 998244353
def main():
import sys
input = sys.stdin.read().split()
ptr = 0
N, Q = int(input[ptr]), int(input[ptr+1])
ptr +=2
A = list(map(int, input[ptr:ptr+N]))
ptr +=N
B = list(map(int, input[ptr:ptr+Q]))
dp = [0]*(N+1)
dp[0] = 1
for a in A:
for j in range(N, 0, -1):
dp[j] = (dp[j] * (a-1) + dp[j-1]) % MOD
dp[0] = dp[0] * (a-1) % MOD
res = []
for b in B:
res.append(dp[b] % MOD)
print(' '.join(map(str, res)))
if __name__ == '__main__':
main()
lam6er