summaryrefslogtreecommitdiff
path: root/datastructures/segmentTree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'datastructures/segmentTree.cpp')
-rw-r--r--datastructures/segmentTree.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/datastructures/segmentTree.cpp b/datastructures/segmentTree.cpp
index 3905151..c810af7 100644
--- a/datastructures/segmentTree.cpp
+++ b/datastructures/segmentTree.cpp
@@ -2,6 +2,8 @@
// Berechnet das Maximum im Array.
int a[MAX_N], m[4 * MAX_N];
+int gcd(int a, int b) { return b == 0 ? a : gcd (b, a % b); }
+
int query(int x, int y, int k = 0, int X = 0, int Y = MAX_N - 1) {
if (x <= X && Y <= y) return m[k];
if (y < X || Y < x) return -INF; // Ein "neutrales" Element.