admu-progvar / progvar-library

Competitive programming library and team notebook maintained by AdMU Programming Varsity
MIT License
14 stars 2 forks source link

Add overloads to segtree functions for convenience #10

Open rap2montemayor opened 2 years ago

rap2montemayor commented 2 years ago

Right now, the update and query functions for the lazy segtree (and probably some of the other data structures) look like:

void update(int _i, int _j, int v, int p, int i, int j);
int query(int _i, int _j, int p, int i, int j);

Forgetting what values are supposed go into p, i, and j has been the source of a lot of dumb mistakes. I'd like to propose the following overloads to avoid those.

void update(int i, int j, int v) { return update(i, j, v, 1, 0, n-1); }
int query(int i, int j) { return query(i, j, 1, 0, n-1); }
leloykun commented 2 years ago

@rap2montemayor , wanna own this issue?