diff options
author | Ta180m | 2020-06-21 15:10:33 -0500 |
---|---|---|
committer | Ta180m | 2020-06-21 15:10:33 -0500 |
commit | db45276f8479216c38188e7637d47f3417771fdc (patch) | |
tree | 200ab98470779da7032e7ba0998ade90d737b078 /Data Structures | |
parent | 6e2e62a032053df653437e991db2b68f4df8913e (diff) |
Update segment_tree.cpp
Diffstat (limited to 'Data Structures')
-rw-r--r-- | Data Structures/segment_tree.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Data Structures/segment_tree.cpp b/Data Structures/segment_tree.cpp index c7b058f..d1974b8 100644 --- a/Data Structures/segment_tree.cpp +++ b/Data Structures/segment_tree.cpp @@ -17,7 +17,7 @@ void update(int x, T v, int l = 0, int r = -1, int n = 1) { void update(int a, int b, int v, int l = 0, int r = -1, int n = 1) { if (r == -1) r = N - 1; push(l, r, n); - if (l > b || r < a) return; + if (l > r || l > b || r < a) return; if (l >= a && r <= b) { tmp[n] += v; push(l, r, n); |