From 1880ccb6d85c6eb79e724593457877bab431951c Mon Sep 17 00:00:00 2001 From: Gloria Mundi Date: Sat, 16 Nov 2024 21:17:29 +0100 Subject: get rid of all() and sz() --- content/datastructures/lichao.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'content/datastructures/lichao.cpp') diff --git a/content/datastructures/lichao.cpp b/content/datastructures/lichao.cpp index c20c61d..bdbf5f9 100644 --- a/content/datastructures/lichao.cpp +++ b/content/datastructures/lichao.cpp @@ -1,5 +1,6 @@ vector xs; // IMPORTANT: Initialize before constructing! -int findX(int i) { return lower_bound(all(xs), i) - begin(xs); } +int findX(int i) { + return ranges::lower_bound(xs, i) - begin(xs); } struct Fun { // Default: Linear function. Change as needed. ll m, c; @@ -11,7 +12,7 @@ struct Lichao { static constexpr Fun id = {0, INF}; // {0, -INF} int n, cap; vector seg; - Lichao() : n(sz(xs)), cap(2 << __lg(n)), seg(2 * cap, id) {} + Lichao() : n(ssize(xs)), cap(2 << __lg(n)), seg(2 * cap, id) {} void _insert(Fun f, int l, int r, int i) { while (i < 2 * cap) { -- cgit v1.2.3