結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー 夜
提出日時 2020-11-30 21:10:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 91,256 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-11 03:03:43
合計ジャッジ時間 2,735 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 45 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 107 ms
4,348 KB
testcase_11 AC 27 ms
4,348 KB
testcase_12 AC 21 ms
4,348 KB
testcase_13 AC 27 ms
4,352 KB
testcase_14 AC 28 ms
4,352 KB
testcase_15 AC 74 ms
4,352 KB
testcase_16 AC 13 ms
4,352 KB
testcase_17 AC 16 ms
4,348 KB
testcase_18 AC 68 ms
4,348 KB
testcase_19 AC 26 ms
4,352 KB
testcase_20 AC 1 ms
4,352 KB
testcase_21 AC 53 ms
4,352 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 111 ms
4,348 KB
testcase_26 AC 110 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long dp[6060] = {};
int main() {
	int n, q;
	cin >> n >> q;
	dp[0] = 1;
	for (int i = 1; i <= n; i++) {
		long long a;
		cin >> a;
		for (int j = n; j >= 0; j--) {
			dp[j] = dp[j] * (a - 1);
			dp[j] %= 998244353;
			if (j != 0) {
				dp[j] += dp[j - 1];
				dp[j] %= 998244353;
			}
		}
	}
	for (int i = 0; i < q; i++) {
		int b;
		cin >> b;
		cout << dp[b] << endl;
	}
}
0