結果
| 問題 | No.1066 #いろいろな色 / Red and Blue and more various colors (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-29 23:49:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 745 bytes |
| 記録 | |
| コンパイル時間 | 2,449 ms |
| コンパイル使用メモリ | 124,652 KB |
| 最終ジャッジ日時 | 2025-01-10 18:32:01 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 MLE * 6 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <random>
#include <set>
#include <queue>
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 998244353;
int n, q, x, y;
ll a[6060];
ll dp[6060][6060];
int main()
{
cin >> n >> q;
REP(i, n)
cin >> a[i];
dp[0][0] = 1;
REP(i, n)
REP(j, n)
{
dp[i + 1][j + 1] += dp[i][j];
dp[i + 1][j + 1] %= MOD;
dp[i + 1][j] += dp[i][j] * (a[i] - 1);
dp[i + 1][j] %= MOD;
}
REP(i, q)
{
int b;
cin >> b;
cout << dp[n][b] << '\n';
}
return 0;
}