結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー imoni_kawaiiimoni_kawaii
提出日時 2020-06-08 22:08:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 843 bytes
コンパイル時間 1,969 ms
コンパイル使用メモリ 197,636 KB
実行使用メモリ 286,196 KB
最終ジャッジ日時 2023-08-27 04:56:44
合計ジャッジ時間 10,646 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,384 KB
testcase_01 AC 3 ms
5,584 KB
testcase_02 AC 2 ms
5,440 KB
testcase_03 AC 2 ms
5,444 KB
testcase_04 AC 2 ms
5,560 KB
testcase_05 AC 2 ms
5,472 KB
testcase_06 AC 2 ms
5,504 KB
testcase_07 AC 2 ms
5,668 KB
testcase_08 AC 393 ms
121,660 KB
testcase_09 AC 2 ms
5,712 KB
testcase_10 MLE -
testcase_11 AC 228 ms
73,040 KB
testcase_12 AC 172 ms
57,572 KB
testcase_13 AC 233 ms
74,992 KB
testcase_14 AC 247 ms
78,664 KB
testcase_15 MLE -
testcase_16 AC 103 ms
36,792 KB
testcase_17 AC 119 ms
41,840 KB
testcase_18 MLE -
testcase_19 AC 218 ms
70,708 KB
testcase_20 AC 3 ms
5,632 KB
testcase_21 MLE -
testcase_22 AC 2 ms
5,676 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,380 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using ll = long long;
using ld = long double;
template<class T, class U> inline bool chmax(T &a, const U &b) { if(a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if(a > b) { a = b; return true; } return false; }

ll MOD = 998244353;
int n, q, a[200000];
ll dp[6010][6010];

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  cin >> n >> q;
  rep(i, n) cin >> a[i];
  dp[0][0] = 1;
  rep(i, n) {
    rep(j, n+1) {
      dp[i+1][j] += dp[i][j]*(a[i]-1);
      dp[i+1][j] %= MOD;
      dp[i+1][j+1] += dp[i][j];
      dp[i+1][j+1] %= MOD;
    }
  }
  rep(qi, q) {
    int b;
    cin >> b;
    cout << dp[n][b] << '\n';
  }
  return 0;
}
0