結果
| 問題 | No.1066 #いろいろな色 / Red and Blue and more various colors (Easy) |
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2020-05-29 23:25:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 789 bytes |
| 記録 | |
| コンパイル時間 | 2,798 ms |
| コンパイル使用メモリ | 219,156 KB |
| 最終ジャッジ日時 | 2025-01-10 18:27:54 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 MLE * 6 |
ソースコード
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#include <bits/stdc++.h>
using namespace std;
#define MOD 998244353
int main(){
ll n,q;
cin>>n>>q;
vector<ll> A(n+1);
A[0]=0;
rep(i,n) cin>>A[i+1];
ll dp[n+1][n+1];
rep(i,n+1) dp[i][i]=1;
for(int i=1;i<=n;i++) dp[i][0]=dp[i-1][0]*(A[i]-1)%MOD;
for(int i=2;i<=n;i++){
for(int j=1;j<i;j++){
dp[i][j]=(dp[i-1][j-1]+dp[i-1][j]*(A[i]-1)%MOD)%MOD;
}
}
int x;
rep(i,q){
cin>>x;
cout<<dp[n][x]<<endl;
}
return 0;
}
umezo