結果

問題 No.1068 #いろいろな色 / Red and Blue and more various colors (Hard)
ユーザー keijakkeijak
提出日時 2022-01-01 17:04:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 291 ms / 3,500 ms
コード長 609 bytes
コンパイル時間 5,203 ms
コンパイル使用メモリ 265,900 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2024-04-18 14:54:51
合計ジャッジ時間 11,288 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,948 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 7 ms
6,940 KB
testcase_04 AC 5 ms
6,940 KB
testcase_05 AC 6 ms
6,940 KB
testcase_06 AC 4 ms
6,944 KB
testcase_07 AC 4 ms
6,944 KB
testcase_08 AC 5 ms
6,940 KB
testcase_09 AC 5 ms
6,944 KB
testcase_10 AC 3 ms
6,940 KB
testcase_11 AC 3 ms
6,940 KB
testcase_12 AC 3 ms
6,940 KB
testcase_13 AC 278 ms
14,848 KB
testcase_14 AC 271 ms
14,976 KB
testcase_15 AC 275 ms
14,848 KB
testcase_16 AC 281 ms
14,848 KB
testcase_17 AC 273 ms
14,976 KB
testcase_18 AC 281 ms
14,848 KB
testcase_19 AC 281 ms
14,848 KB
testcase_20 AC 280 ms
14,976 KB
testcase_21 AC 291 ms
14,976 KB
testcase_22 AC 279 ms
14,848 KB
testcase_23 AC 278 ms
14,848 KB
testcase_24 AC 281 ms
14,848 KB
testcase_25 AC 267 ms
14,848 KB
testcase_26 AC 272 ms
14,976 KB
testcase_27 AC 270 ms
14,848 KB
testcase_28 AC 279 ms
14,976 KB
testcase_29 AC 267 ms
14,848 KB
testcase_30 AC 262 ms
14,848 KB
testcase_31 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using Mint = atcoder::modint998244353;
int main() {
  int N, Q;
  scanf("%d%d",&N,&Q);
  deque<vector<Mint>> q;
  for (int i = 0; i < N; ++i) {
    long long a;
    scanf("%lld",&a);
    q.push_back(vector<Mint>{a-1,1});
  }
  while (q.size() > 1) {
    auto r = atcoder::convolution(q[0],q[1]);
    if (r.size() > N+1) r.resize(N+1);
    q.pop_front();q.pop_front();
    q.push_back(r);
  }
  const auto &f = q.front();
  for (int i = 0, b; i < Q; ++i) {
    scanf("%d", &b);
    printf("%u\n", f[b].val());
  }
}
0