voidadd(ll m, ll k){ auto z = insert({-k, -m, 0}), y = z++, x = y; while (isect(y, z)) z = erase(z); if (x != begin() && isect(--x, y)) isect(x, y = erase(y)); while ((y = x) != begin() && (--x)->p >= y->p) isect(x, erase(y)); }
ll query(ll x){ auto l = *lower_bound(x); return -(l.k * x + l.m); } };
ll minPartitionScore(vector<int>& nums, int k){ int n = nums.size(); vector<ll> P(n + 1, 0); for (int i = 1; i <= n; i++) P[i] = P[i - 1] + nums[i - 1];
auto tri = [&](ll s) -> ll { return s * (s + 1) / 2; };