diff options
| author | pjungeblut <paul.jungeblut@gmail.com> | 2014-11-08 19:57:29 +0100 |
|---|---|---|
| committer | pjungeblut <paul.jungeblut@gmail.com> | 2014-11-08 19:57:29 +0100 |
| commit | ac889693eefcb61632c79a78cf7f2600e56a73b6 (patch) | |
| tree | 1491adf2ccbe8f2eb128f98285374dd0d7835774 | |
| parent | ac16d3eb6c2d9058495a2f88a747e7d24ce3a095 (diff) | |
corrected wrong code.1
corrected wrong code.2
| -rw-r--r-- | datastructures/segmentTree.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/datastructures/segmentTree.cpp b/datastructures/segmentTree.cpp index 6b73ec0..14973fe 100644 --- a/datastructures/segmentTree.cpp +++ b/datastructures/segmentTree.cpp @@ -10,8 +10,8 @@ int query(int x, int y, int k = 0, int X = 0, int Y = MAX_N - 1) { void update(int i, int v, int k = 0, int X = 0, int Y = MAX_N - 1) { if (i < X || Y < i) return; if (X == Y) { - m[k] = w; - a[i] = w; + m[k] = v; + a[i] = v; return; } int M = (X + Y) / 2; @@ -29,4 +29,4 @@ void init(int k = 0, int X = 0, int Y = MAX_N - 1) { init(2 * k + 1, X, M); init(2 * k + 2, M + 1, Y); m[k] = max(m[2 * k + 1], m[2 * k + 2]); -}
\ No newline at end of file +} |
