group/monoid/add.hpp
- View this file on GitHub
- Last update: 2024-06-10 16:05:09+07:00
- Include:
#include "group/monoid/add.hpp"
Required by
group/monoid-action/add-count-add.hpp
group/monoid-action/max-add.hpp
group/monoid-action/max-count-add.hpp
group/monoid-action/max-idx-add.hpp
group/monoid-action/min-add.hpp
group/monoid-action/min-count-add.hpp
group/monoid-action/min-idx-add.hpp
Verified with
verify/yosupo/data-structure/area_of_union_of_rectangles.test.cpp
verify/yosupo/data-structure/range_reverse_range_sum.test.cpp
Code
#pragma once
/**
* Author: Teetat T.
* Date: 2024-04-14
* Description: Add Monoid class.
*/
template<class T>
struct AddMonoid{
using value_type = T;
static constexpr T op(const T &x,const T &y){return x+y;}
static constexpr T inverse(const T &x){return -x;}
static constexpr T unit(){return T(0);}
};#line 2 "group/monoid/add.hpp"
/**
* Author: Teetat T.
* Date: 2024-04-14
* Description: Add Monoid class.
*/
template<class T>
struct AddMonoid{
using value_type = T;
static constexpr T op(const T &x,const T &y){return x+y;}
static constexpr T inverse(const T &x){return -x;}
static constexpr T unit(){return T(0);}
};