結果
問題 |
No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
|
ユーザー |
![]() |
提出日時 | 2025-03-31 17:25:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 406 bytes |
コンパイル時間 | 186 ms |
コンパイル使用メモリ | 82,788 KB |
実行使用メモリ | 65,736 KB |
最終ジャッジ日時 | 2025-03-31 17:26:09 |
合計ジャッジ時間 | 3,169 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 24 |
ソースコード
MOD = 998244353 n, q = map(int, input().split()) A = list(map(int, input().split())) s = [a - 1 for a in A] queries = list(map(int, input().split())) dp = [0] * (n + 1) dp[0] = 1 for i in range(n): a = s[i] for j in range(i + 1, 0, -1): dp[j] = (dp[j] * a + dp[j - 1]) % MOD dp[0] = (dp[0] * a) % MOD result = [str(dp[b]) if b <= n else '0' for b in queries] print(' '.join(result))