icpc-snippet

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

View the Project on GitHub EarthMessenger/icpc-snippet

:warning: lib/ds/dynsegtree.hpp

Depends on

Code

#pragma once
#include "lib/internal.hpp"
#include <array>

template<typename S, typename F, int id = 0>
class DynamicSegmentTree
{
public:
    const S e;
    const F op;

    struct Node
    {
        S val;
        u32 ls, rs;
        Node(S v): val(v), ls(), rs() { }
    };

    u32 n, root;
    static vec<Node> t;

    DynamicSegmentTree(u32 _n, const S &_e, const F &_op): n(_n), e(_e), op(_op) { }

    void update(u32 x) { t[x].val = op(t[t[x].ls].val, t[t[x].rs].val); }

    static u32 new_node() 
    {
        t.emplace_back(e);
        return t.size() - 1u;
    }

    void set(u32 x, const S &v)
    {
        if (x == 0) x = new_node();
    }

private:

    void set_rec(const S &v, u32 l, u32 r, u32 x)
    {
        if (x == 0) x = new_node();
    }
};
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/internal.hpp: line 4: #pragma once found in a non-first line
Back to top page