Skip to content

Instantly share code, notes, and snippets.

@utkarshl
Last active December 10, 2015 06:28
Show Gist options
  • Save utkarshl/4394232 to your computer and use it in GitHub Desktop.
Save utkarshl/4394232 to your computer and use it in GitHub Desktop.
struct node
{
int min, add;
split(const node& a, const node& b)
{
a.add+=add, a.min+=add,
b.add+=add, b.min+=add;
add=0;
}
void merge(node a, node b)
{
min = min( a.min, b.min );
add = 0;
}
};
void update_single_node(node& n, int add)
{
n.add+=add,
n.min+=add;
}
//range_query, update and range_update remain same.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment