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/ds/point_set_range_composite.test.cpp

Depends on

Code

#include "lib/ds/segtree.hpp"
#include "lib/math/static_modint.hpp"
#include "lib/monoid/monoid_trait.hpp"

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

struct LinearFunc
{
    using mint = static_modint<998244353>;
    mint k, b;
    LinearFunc(mint _k = 1, mint _b = 0): k(_k), b(_b) { }
    LinearFunc operator*(const LinearFunc &t) const 
    { 
        return {k * t.k, b * t.k + t.b}; 
    }
    mint apply(mint x) { return k * x + b; }
};

signed main()
{
    using namespace std;
    ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
    auto read_int = [x = int()]() mutable { return cin >> x, x; };
    u32 n = read_int(), q = read_int();
    vec<LinearFunc> a(n);
    for (auto &[k, b]: a) k = read_int(), b = read_int();
    SegmentTree<mono::MonoidTrait<LinearFunc>> s(n, [&a](u32 i){return a[i];});
    while (q--) {
        u32 op, x, y, z;
        cin >> op >> x >> y >> z;
        if (op == 0) s.set(x, {y, z});
        else cout << s.prod(x, y).apply(z).val() << '\n';
    }
}
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 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