MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / node

Class node

code/data-structures/segment_tree_node.cpp:3–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#ifndef STNODE
2#define STNODE
3struct node {
4 int l, r;
5 ll x, lazy;
6 node() {}
7 node(int _l, int _r) : l(_l), r(_r), x(0), lazy(0) { }
8 node(int _l, int _r, ll _x) : node(_l,_r) { x = _x; }
9 node(node a, node b) : node(a.l,b.r) { x = a.x + b.x; }
10 void update(ll v) { x = v; }
11 void range_update(ll v) { lazy = v; }
12 void apply() { x += lazy * (r - l + 1); lazy = 0; }
13 void push(node &u) { u.lazy += lazy; } };
14#endif
15// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected