This documentation is automatically generated by online-judge-tools/verification-helper
#include "alg/acted_monoid/summax_add.hpp"
#include "alg/monoid/summax.hpp"
#include "alg/monoid/add.hpp"
template <typename E>
struct ActedMonoid_SumMax_Add {
using Monoid_X = Monoid_SumMax<E>;
using Monoid_A = Monoid_Add<E>;
using X = typename Monoid_X::value_type;
using A = typename Monoid_A::value_type;
static constexpr X act(const X& x, const A& a, const ll& size) {
auto [xs, xm] = x;
xm = (xm == -infty<E> ? xm : xm + a);
return {xs + E(size) * a, xm};
}
};
#line 2 "alg/monoid/summax.hpp"
template <typename E>
struct Monoid_SumMax {
using value_type = pair<E, E>;
using X = value_type;
static X op(X x, X y) { return {x.fi + y.fi, max(x.se, y.se)}; }
static X from_element(E e) { return {e, e}; }
static constexpr X unit() { return {E(0), -infty<E>}; }
static constexpr bool commute = 1;
};
#line 2 "alg/monoid/add.hpp"
template <typename E>
struct Monoid_Add {
using X = E;
using value_type = X;
static constexpr X op(const X &x, const X &y) noexcept { return x + y; }
static constexpr X inverse(const X &x) noexcept { return -x; }
static constexpr X power(const X &x, ll n) noexcept { return X(n) * x; }
static constexpr X unit() { return X(0); }
static constexpr bool commute = true;
};
#line 3 "alg/acted_monoid/summax_add.hpp"
template <typename E>
struct ActedMonoid_SumMax_Add {
using Monoid_X = Monoid_SumMax<E>;
using Monoid_A = Monoid_Add<E>;
using X = typename Monoid_X::value_type;
using A = typename Monoid_A::value_type;
static constexpr X act(const X& x, const A& a, const ll& size) {
auto [xs, xm] = x;
xm = (xm == -infty<E> ? xm : xm + a);
return {xs + E(size) * a, xm};
}
};