MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / Line

Class Line

code/data-structures/convex_hull_trick_dynamic.cpp:2–10  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1const ll is_query = -(1LL<<62);
2struct Line {
3 ll m, b;
4 mutable function<const Line*()> succ;
5 bool operator<(const Line& rhs) const {
6 if (rhs.b != is_query) return m < rhs.m;
7 const Line* s = succ();
8 if (!s) return 0;
9 ll x = rhs.m;
10 return b - s->b < (s->m - m) * x; } };
11// will maintain upper hull for maximum
12struct HullDynamic : public multiset<Line> {
13 bool bad(iterator y) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected