diff options
| author | Paul Jungeblut <paul.jungeblut@gmail.com> | 2018-01-03 17:06:36 +0100 |
|---|---|---|
| committer | Paul Jungeblut <paul.jungeblut@gmail.com> | 2018-01-03 17:06:36 +0100 |
| commit | 025b4a5abd77a705c313aee0b8d329fed4f47c42 (patch) | |
| tree | 65a713e3db21602172150045af8e8cc4100eadc5 /datastructures/dynamicConvexHull.cpp | |
| parent | 412e5011becbbc52864fe8764626498a2ad87647 (diff) | |
Fixing two errors in convex hull optimization code.
Diffstat (limited to 'datastructures/dynamicConvexHull.cpp')
| -rw-r--r-- | datastructures/dynamicConvexHull.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/datastructures/dynamicConvexHull.cpp b/datastructures/dynamicConvexHull.cpp index 9ccf220..042d26c 100644 --- a/datastructures/dynamicConvexHull.cpp +++ b/datastructures/dynamicConvexHull.cpp @@ -3,7 +3,7 @@ struct Line { ll m, b; mutable function<const Line*()> succ; bool operator<(const Line& rhs) const { - if (rhs.b != is_query) return m < rhs.m; + if (rhs.b != LLONG_MIN) return m < rhs.m; const Line* s = succ(); if (!s) return 0; ll x = rhs.m; @@ -28,8 +28,8 @@ struct HullDynamic : public multiset<Line> { while (next(y) != end() && bad(next(y))) erase(next(y)); while (y != begin() && bad(prev(y))) erase(prev(y)); } - ll query(ll x) { // Laufzeit: O(log(n)) - auto l = *lower_bound((Line) { x, -(1LL<<62) }); + ll query(ll x) { // Laufzeit: O(log(n)) + auto l = *lower_bound((Line) {x, LLONG_MIN}); return l.m * x + l.b; } }; |
