kyopro-lib

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

View on GitHub

:x: Affine monoid
(Mylib/AlgebraicStructure/Monoid/affine.cpp)

Operations

Requirements

Notes

Problems

References

Verified with

Code

#pragma once
#include <utility>

namespace haar_lib {
  template <typename T>
  struct affine_monoid {
    using value_type = std::pair<T, T>;
    value_type operator()() const { return std::make_pair(1, 0); }
    value_type operator()(const value_type &a, const value_type &b) const {
      return std::make_pair(a.first * b.first, a.first * b.second + a.second);
    }
  };
}  // namespace haar_lib
#line 2 "Mylib/AlgebraicStructure/Monoid/affine.cpp"
#include <utility>

namespace haar_lib {
  template <typename T>
  struct affine_monoid {
    using value_type = std::pair<T, T>;
    value_type operator()() const { return std::make_pair(1, 0); }
    value_type operator()(const value_type &a, const value_type &b) const {
      return std::make_pair(a.first * b.first, a.first * b.second + a.second);
    }
  };
}  // namespace haar_lib
Back to top page