結果
| 問題 | No.1066 #いろいろな色 / Red and Blue and more various colors (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-06 20:48:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 2,000 ms |
| コード長 | 440 bytes |
| 記録 | |
| コンパイル時間 | 4,222 ms |
| コンパイル使用メモリ | 252,928 KB |
| 最終ジャッジ日時 | 2025-02-21 11:27:44 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using mint = atcoder::modint998244353;
int main(){
int n, q;
cin >> n >> q;
vector<int> a(n), b(q);
for(auto &&v:a)cin >> v;
for(auto &&v:b)cin >> v;
vector<mint> dp(n + 1);
dp[0] = 1;
for(int i = 0; i < n; i++){
for(int j = i; j >= 0; j--){
dp[j + 1] += dp[j];
dp[j] *= a[i] - 1;
}
}
for(auto &&v:b)cout << dp[v].val() << '\n';
}