結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー m_9719m_9719
提出日時 2020-05-29 21:44:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,394 bytes
コンパイル時間 1,757 ms
コンパイル使用メモリ 167,676 KB
実行使用メモリ 285,436 KB
最終ジャッジ日時 2024-04-23 21:02:55
合計ジャッジ時間 4,448 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 86 ms
105,472 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 MLE -
testcase_11 AC 49 ms
60,508 KB
testcase_12 AC 38 ms
46,336 KB
testcase_13 AC 50 ms
62,436 KB
testcase_14 AC 54 ms
65,664 KB
testcase_15 MLE -
testcase_16 AC 24 ms
27,908 KB
testcase_17 AC 27 ms
32,336 KB
testcase_18 MLE -
testcase_19 AC 48 ms
58,424 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 MLE -
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(998244353)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef pair<double,int> PDI;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


signed main(){
	ll n,q; cin>>n>>q;
	VL a(n); rep(i,n) cin>>a[i];
	ll dp[n+5][n+5];
	rep(i,n+5)rep(j,n+5) dp[i][j]=0LL;
	dp[0][0]=1LL;
	rep(i,n){
		rep(j,n){
			dp[i+1][j]+=dp[i][j]*(a[i]-1)%MOD;
			dp[i+1][j]%=MOD;
			dp[i+1][j+1]+=dp[i][j];
			dp[i+1][j+1]%=MOD;
		}
	}
	rep(i,q){
		int b; cin>>b;
		cout<<dp[n][b]<<endl;
	}
	return 0;
}
0