From 025b4a5abd77a705c313aee0b8d329fed4f47c42 Mon Sep 17 00:00:00 2001 From: Paul Jungeblut Date: Wed, 3 Jan 2018 17:06:36 +0100 Subject: Fixing two errors in convex hull optimization code. --- datastructures/dynamicConvexHull.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'datastructures/dynamicConvexHull.cpp') 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 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 { 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; } }; -- cgit v1.2.3