diff options
Diffstat (limited to 'datastructures/monotonicConvexHull.cpp')
| -rw-r--r-- | datastructures/monotonicConvexHull.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/datastructures/monotonicConvexHull.cpp b/datastructures/monotonicConvexHull.cpp index a93bfae..64af841 100644 --- a/datastructures/monotonicConvexHull.cpp +++ b/datastructures/monotonicConvexHull.cpp @@ -10,7 +10,9 @@ void add(ll m, ll b) { // Laufzeit O(1) amortisiert ms.push_back(m); bs.push_back(b); while (ms.size() >= 3 && bad(ms.size() - 3, ms.size() - 2, ms.size() - 1)) { ms.erase(ms.end() - 2); bs.erase(bs.end() - 2); -}} + } + ptr = min(ptr, ms.size() - 1); +} ll get(int idx, ll x) { return ms[idx] * x + bs[idx]; } |
