library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub maspypy/library

:heavy_check_mark: alg/monoid/summax.hpp

Required by

Verified with

Code

#pragma once

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/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;
};
Back to top page