CP-Algorithms Library

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub cp-algorithms/cp-algorithms-aux

:heavy_check_mark: Subset Convolution (verify/math/subset_convolution.test.cpp)

Depends on

Code

// @brief Subset Convolution
#define PROBLEM "https://judge.yosupo.jp/problem/subset_convolution"
#pragma GCC optimize("O3,unroll-loops")
#include <bits/allocator.h>
#pragma GCC target("avx2")
#include <iostream>
#include "blazingio/blazingio.min.hpp"
#define CP_ALGO_CHECKPOINT
#include "cp-algo/number_theory/modint.hpp"
#include "cp-algo/math/subset_convolution.hpp"
#include <bits/stdc++.h>

using namespace std;

const int mod = 998244353;
using base = cp_algo::math::modint<mod>;

void solve() {
    uint32_t n;
    cin >> n;
    size_t N = 1 << n;
    cp_algo::big_vector<base> a(N), b(N);
    for(auto &it: a) {cin >> it;}
    for(auto &it: b) {cin >> it;}
    cp_algo::checkpoint("read");
    auto c = cp_algo::math::subset_convolution<base>(a, b);
    for(auto &it: c) {cout << it << ' ';}
    cp_algo::checkpoint("write");
    cp_algo::checkpoint<1>();
}

signed main() {
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    t = 1;// cin >> t;
    while(t--) {
        solve();
    }
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj_resolve/resolver.py", line 181, in resolve
    bundled_code = language.bundle(path, basedir=basedir)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus.py", line 252, in bundle
    bundler.update(path)
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 327, in update
    assert len(lines) == len(uncommented_lines)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Test cases

Env Name Status Elapsed Memory
g++ example_00 :heavy_check_mark: AC 6 ms 6 MB
g++ hack01_00 :heavy_check_mark: AC 133 ms 39 MB
g++ max_random_00 :heavy_check_mark: AC 137 ms 47 MB
g++ max_random_01 :heavy_check_mark: AC 139 ms 47 MB
g++ max_random_02 :heavy_check_mark: AC 140 ms 47 MB
g++ random_00 :heavy_check_mark: AC 140 ms 47 MB
g++ random_01 :heavy_check_mark: AC 6 ms 6 MB
g++ random_02 :heavy_check_mark: AC 5 ms 6 MB
g++ small_00 :heavy_check_mark: AC 5 ms 6 MB
g++ small_01 :heavy_check_mark: AC 5 ms 6 MB
g++ small_02 :heavy_check_mark: AC 5 ms 6 MB
Back to top page