diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 21:17:29 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 21:17:29 +0100 |
| commit | 1880ccb6d85c6eb79e724593457877bab431951c (patch) | |
| tree | 23eddd5bd0b29b3024e170a5ef9023eda9226ab5 /content/datastructures/monotonicConvexHull.cpp | |
| parent | e95f59debd69ee7d45d5c966ce466d23264e1c3c (diff) | |
get rid of all() and sz()
Diffstat (limited to 'content/datastructures/monotonicConvexHull.cpp')
| -rw-r--r-- | content/datastructures/monotonicConvexHull.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/content/datastructures/monotonicConvexHull.cpp b/content/datastructures/monotonicConvexHull.cpp index 2bdeccf..295acc4 100644 --- a/content/datastructures/monotonicConvexHull.cpp +++ b/content/datastructures/monotonicConvexHull.cpp @@ -12,15 +12,14 @@ struct Envelope { } void add(ll m, ll b) { - while (sz(ls) > 1 && bad(ls.end()[-2], ls.back(), {m, b})) { - ls.pop_back(); - } + while (ssize(ls) > 1 + && bad(ls.end()[-2], ls.back(), {m,b})) ls.pop_back(); ls.push_back({m, b}); - ptr = min(ptr, (int)sz(ls) - 1); + ptr = min(ptr, (int)ssize(ls) - 1); } ll query(ll x) { - while (ptr < sz(ls)-1 && ls[ptr + 1](x) < ls[ptr](x)) ptr++; + while (ptr < ssize(ls)-1 && ls[ptr+1](x) < ls[ptr](x)) ptr++; return ls[ptr](x); } }; |
