icpc-snippet

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub EarthMessenger/icpc-snippet

:heavy_check_mark: verify/math/convolution.test.cpp

Depends on

Code

#define PROBLEM "https://judge.yosupo.jp/problem/convolution_mod"

#include "lib/misc/bitop.hpp"
#include "lib/math/convolution.hpp"
#include "lib/math/static_modint.hpp"

signed main() 
{
    using namespace std;
    ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
    using mint = static_modint<998244353>;
    auto read_int = [x = int()]() mutable { return cin >> x, x; };
    u32 n = read_int(), m = read_int();
    u32 p = lg2(max(btc(n), btc(m))) + 1, q = 1 << p;
    vec<mint> a(q), b(q);
    for (u32 i = 0; i < n; i++) a[i] = read_int();
    for (u32 i = 0; i < m; i++) b[i] = read_int();
    auto base = [](u32 h) { return mint::raw(3).pow(998244352 / h); };
    auto inv = [iv2 = mint(q).inv()](mint &x,[[maybe_unused]] u32 y){x *= iv2;};
    poly::fourier_transform<0>(p, a, base, inv, mint::raw(1));
    poly::fourier_transform<0>(p, b, base, inv, mint::raw(1));
    for (u32 i = 0; i < q; i++) a[i] *= b[i];
    poly::fourier_transform<1>(p, a, base, inv, mint::raw(1));
    reverse(a.begin() + 1, a.end());
    for (u32 i = 0; i < n + m - 1; i++) cout << a[i].val() << ' ';
    cout << '\n';
    return 0;
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
    self.update(self._resolve(pathlib.Path(included), included_from=path))
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 312, in update
    raise BundleErrorAt(path, i + 1, "#pragma once found in a non-first line")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: lib/misc/bitop.hpp: line 4: #pragma once found in a non-first line
Back to top page