library

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

View the Project on GitHub maspypy/library

:heavy_check_mark: alg/monoid/minmax.hpp

Required by

Verified with

Code

#pragma once

template <class X>
struct Monoid_MinMax {
  using P = pair<X, X>;
  using value_type = P;
  static constexpr P op(const P x, const P y) noexcept {
    return {min(x.fi, y.fi), max(x.se, y.se)};
  }
  static constexpr P from_element(const X x) { return {x, x}; }
  static constexpr P unit() { return {infty<X>, -infty<X>}; }
  static constexpr bool commute = true;
};
#line 2 "alg/monoid/minmax.hpp"

template <class X>
struct Monoid_MinMax {
  using P = pair<X, X>;
  using value_type = P;
  static constexpr P op(const P x, const P y) noexcept {
    return {min(x.fi, y.fi), max(x.se, y.se)};
  }
  static constexpr P from_element(const X x) { return {x, x}; }
  static constexpr P unit() { return {infty<X>, -infty<X>}; }
  static constexpr bool commute = true;
};
Back to top page