結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー keijakkeijak
提出日時 2022-01-01 15:55:43
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 837 bytes
コンパイル時間 3,407 ms
コンパイル使用メモリ 223,892 KB
最終ジャッジ日時 2024-04-18 13:39:17
合計ジャッジ時間 4,381 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/string:43,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bitset:52,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/x86_64-pc-linux-gnu/bits/stdc++.h:52,
                 from main.cpp:4:
/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/allocator.h: In destructor 'std::_Vector_base<long long int, std::allocator<long long int> >::_Vector_impl::~_Vector_impl()':
/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = long long int]': target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/vector:66,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/functional:64,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/x86_64-pc-linux-gnu/bits/stdc++.h:53:
/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <atcoder/convolution>
#include <atcoder/modint>
#define REP(i, n) for (int i = 0, REP_N_ = int(n); i < REP_N_; ++i)
using namespace std;
using Mint = atcoder::modint998244353;

int main() {
  int N, Q;
  scanf("%d%d", &N, &Q);

  deque<vector<Mint>> q;
  REP(i, N) {
    int a;
    scanf("%d", &a);
    q.push_back(vector<Mint>{Mint(a - 1), Mint(1)});
  }
  while (q.size() > 1) {
    auto r = atcoder::convolution(move(q[0]), move(q[1]));
    if (int(r.size()) > N + 1) r.resize(N + 1);
    while (r.back() == 0) r.pop_back();
    q.pop_front();
    q.pop_front();
    q.push_back(move(r));
  }
  const auto &f = q.front();
  REP(i, Q) {
    int b;
    scanf("%d", &b);
    printf("%u\n", f[b].val());
  }
}
0