library

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

View the Project on GitHub maspypy/library

:heavy_check_mark: alg/monoid/add_pair.hpp

Required by

Verified with

Code

#pragma once

template <typename E>
struct Monoid_Add_Pair {
  using value_type = pair<E, E>;
  using X = value_type;
  static constexpr X op(const X &x, const X &y) {
    return {x.fi + y.fi, x.se + y.se};
  }
  static constexpr X inverse(const X &x) { return {-x.fi, -x.se}; }
  static constexpr X unit() { return {0, 0}; }
  static constexpr bool commute = true;
};
#line 2 "alg/monoid/add_pair.hpp"

template <typename E>
struct Monoid_Add_Pair {
  using value_type = pair<E, E>;
  using X = value_type;
  static constexpr X op(const X &x, const X &y) {
    return {x.fi + y.fi, x.se + y.se};
  }
  static constexpr X inverse(const X &x) { return {-x.fi, -x.se}; }
  static constexpr X unit() { return {0, 0}; }
  static constexpr bool commute = true;
};
Back to top page