library/algebra/group/Add.hpp
- View this file on GitHub
- Last update: 2025-11-24 18:49:07+09:00
- Include:
#include "library/algebra/group/Add.hpp"
Depends on
Required by
library/algebra/lazy/AddMin.hpp
library/algebra/lazy/AddSum.hpp
library/datastructure/FenwickTree.hpp
library/datastructure/GroupWaveletMatrix.hpp
library/math/FactorialNumberSystem.hpp
library/sequence/AhoCorasick.hpp
library/sequence/Trie.hpp
Verified with
test/AOJ/1330.test.cpp
test/AOJ/2207.test.cpp
test/AOJ/2212.test.cpp
test/AOJ/DSL_1_B.test.cpp
test/AOJ/DSL_2_B.test.cpp
test/AOJ/DSL_2_E.test.cpp
test/AOJ/DSL_2_G.test.cpp
test/AOJ/DSL_2_H.test.cpp
test/AOJ/GRL_5_E.test.cpp
test/library-checker/DataStructure/PointAddRangeSum.test.cpp
test/library-checker/DataStructure/PointAddRectangleSum.test.cpp
test/library-checker/DataStructure/RectangleSum.test.cpp
test/library-checker/DataStructure/UnionfindWithPotential.test.cpp
test/library-checker/Tree/vertex_add_path_sum.test.cpp
test/library-checker/Tree/vertex_add_subtree_sum.test.cpp
test/yukicoder/1038.test.cpp
test/yukicoder/1097.test.cpp
test/yukicoder/430.test.cpp
test/yukicoder/430_2.test.cpp
test/yukicoder/924.test.cpp
Code
#pragma once
template<typename X>
struct GroupAdd {
using value_type = X;
static constexpr X op(const X &x, const X &y) noexcept { return x + y; }
static constexpr void Rchop(X&x, const X&y){ x+=y; }
static constexpr void Lchop(const X&x, X&y){ y+=x; }
static constexpr X inverse(const X &x) noexcept { return -x; }
static constexpr X power(const X &x, long long n) noexcept { return X(n) * x; }
static constexpr X unit() { return X(0); }
static constexpr bool commute = true;
};#line 2 "library/algebra/group/Add.hpp"
template<typename X>
struct GroupAdd {
using value_type = X;
static constexpr X op(const X &x, const X &y) noexcept { return x + y; }
static constexpr void Rchop(X&x, const X&y){ x+=y; }
static constexpr void Lchop(const X&x, X&y){ y+=x; }
static constexpr X inverse(const X &x) noexcept { return -x; }
static constexpr X power(const X &x, long long n) noexcept { return X(n) * x; }
static constexpr X unit() { return X(0); }
static constexpr bool commute = true;
};