Skip to the content.

:warning: library/datastructure/CumulativeGroup.hpp

Depends on

Code

#include "library/algebra/group/Concepts.hpp"

template <group G> struct CumulativeGroup {
    using T = typename G::value_type;
    std::vector<T> A;
    CumulativeGroup() : A(1, G::unit()) {}
    CumulativeGroup(const std::vector<T> &v) : A(v.size() + 1, G::unit()) {
        for (int i = 0; i < v.size(); i++)
            A[i + 1] = G::op(A[i], v[i]);
    }
    void add(const T &a) { A.push_back(G::op(A.back(), a)); }
    T sum(int l, int r) {
        assert(0 <= l and l <= r and r < A.size());
        return G::op(A[r], G::inverse(A[l]));
    }
    T sum() { return A.back(); }
};
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/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 "/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
    ~~~~~~~~~~~~~~^^^^^^
  File "/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
    self.update(self._resolve(pathlib.Path(included), included_from=path))
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/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: library/algebra/group/Concepts.hpp: line 3: #pragma once found in a non-first line
Back to top page