aboutsummaryrefslogtreecommitdiff
path: root/Data Structures
diff options
context:
space:
mode:
authorTa180m2020-01-06 18:38:57 -0600
committerTa180m2020-01-06 18:38:57 -0600
commitfbe807c036a4801e679087906c6cbe88204c471e (patch)
tree4a43c207c1b59082bc0b229f1ec7317b56c049bd /Data Structures
parentc0347786158dfd1808c16e8616f95a2a0714c5bb (diff)
Update segment_tree_v2.cpp
Diffstat (limited to 'Data Structures')
-rw-r--r--Data Structures/segment_tree_v2.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Data Structures/segment_tree_v2.cpp b/Data Structures/segment_tree_v2.cpp
index 546f6fd..9c10532 100644
--- a/Data Structures/segment_tree_v2.cpp
+++ b/Data Structures/segment_tree_v2.cpp
@@ -67,7 +67,7 @@ public:
}
T query(int a, int b, int l = 0, int r = -1, int n = 1) {
if (r == -1) r = N - 1;
- if (l > b || r < a) return 0;
+ if (a > b || l > b || r < a) return 0;
push(l, r, n);
if (l >= a && r <= b) return seg[n];
int m = (l + r) >> 1;