結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー 夜
提出日時 2020-11-30 21:08:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 705 bytes
コンパイル時間 1,286 ms
コンパイル使用メモリ 91,040 KB
実行使用メモリ 287,452 KB
最終ジャッジ日時 2023-10-11 03:03:31
合計ジャッジ時間 6,119 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 170 ms
119,312 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 MLE -
testcase_11 AC 103 ms
70,884 KB
testcase_12 AC 80 ms
55,472 KB
testcase_13 AC 105 ms
72,916 KB
testcase_14 AC 110 ms
76,876 KB
testcase_15 MLE -
testcase_16 AC 49 ms
34,728 KB
testcase_17 AC 57 ms
39,712 KB
testcase_18 MLE -
testcase_19 AC 100 ms
68,512 KB
testcase_20 AC 2 ms
4,352 KB
testcase_21 MLE -
testcase_22 AC 3 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 1 ms
4,480 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

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][6060] = {};
int main() {
	int n, q;
	cin >> n >> q;
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		long long a;
		cin >> a;
		for (int j = 0; j <= n; j++) {
			dp[i][j] += dp[i - 1][j] * (a - 1);
			dp[i][j] %= 998244353;
			if (j != 0) {
				dp[i][j] += dp[i - 1][j - 1];
				dp[i][j] %= 998244353;
			}
		}
	}
	for (int i = 0; i < q; i++) {
		int b;
		cin >> b;
		cout << dp[n][b] << endl;
	}
}
0