This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub dnx04/algo
#define PROBLEM \ "https://judge.yosupo.jp/problem/dynamic_sequence_range_affine_range_sum" #include <bits/extc++.h> using namespace std; using namespace __gnu_cxx; using namespace __gnu_pbds; #include "utility/static_modulo.hpp" #include "data-structure/splay.hpp" using Fp = static_modulo<998244353>; struct S { Fp sum; int sz; }; struct F { Fp a, b; }; using Node = node_t<Fp, S, F>; S op(S left, Fp key, S right) { return S{left.sum + key + right.sum, left.sz + 1 + right.sz}; }; pair<Fp, S> e() { return {0, {0, 0}}; } pair<Fp, S> mapping(F f, Node* node) { return {(f.a * node->key + f.b), S{f.a * node->data.sum + f.b * node->data.sz, node->data.sz}}; } F composition(F f, F g) { return F{f.a * g.a, f.a * g.b + f.b}; } F id() { return F{1, 0}; } void solve([[maybe_unused]] int ith) { int n, q; cin >> n >> q; splay_tree<Fp, S, op, e, F, mapping, composition, id> st; for (int i = 0; i < n; ++i) { int x; cin >> x; st.insert(i, x); } while (q--) { int t; cin >> t; if (t == 0) { int pos, val; cin >> pos >> val; st.insert(pos, val); } else if (t == 1) { int pos; cin >> pos; st.erase(pos); } else if (t == 2) { int l, r; cin >> l >> r; st.reverse(l, r); } else if (t == 3) { int l, r, a, b; cin >> l >> r >> a >> b; st.apply(l, r, F{a, b}); } else { int l, r; cin >> l >> r; cout << st.prod(l, r).sum << '\n'; } } } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr), cin.exceptions(cin.failbit); int tc = 1; // cin >> tc; for (int i = 1; i <= tc; ++i) solve(i); }
Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/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.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle bundler.update(path) File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/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.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 260, in _resolve raise BundleErrorAt(path, -1, "no such header") onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: utility/static_modulo.hpp: line -1: no such header