結果
| 問題 |
No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-29 21:29:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 200 ms / 2,000 ms |
| コード長 | 521 bytes |
| コンパイル時間 | 1,630 ms |
| コンパイル使用メモリ | 166,356 KB |
| 実行使用メモリ | 96,640 KB |
| 最終ジャッジ日時 | 2024-11-06 02:31:18 |
| 合計ジャッジ時間 | 3,757 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
int dp[6200][6200];
int a[7000];
int main(){
int n,q;cin>>n>>q;
rep(i,n)scanf("%d",&a[i]);
dp[0][0]=1;
rep(i,n)rep(j,n){
if(dp[i][j]==0)continue;
(dp[i+1][j+1]+=dp[i][j])%=MOD;
(dp[i+1][j]+=dp[i][j]*(ll)(a[i]-1)%MOD)%=MOD;
}
rep(i,q){
int b;scanf("%d",&b);
printf("%d\n",dp[n][b]);
}
}