Algorithms

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

View the Project on GitHub HyunjaeLee/Algorithms

:heavy_check_mark: monoids/sum.hpp

Verified with

Code

#ifndef SUM_HPP
#define SUM_HPP

// Additive Abelian Group
template <typename T> struct Sum {
    T val;
    static Sum op(Sum a, Sum b) { return {a.val + b.val}; }
    static Sum e() { return {0}; }
    static Sum inv(Sum x) { return {-x.val}; }
    friend bool operator==(const Sum &a, const Sum &b) { return a.val == b.val; }
};

#endif // SUM_HPP
#line 1 "monoids/sum.hpp"



// Additive Abelian Group
template <typename T> struct Sum {
    T val;
    static Sum op(Sum a, Sum b) { return {a.val + b.val}; }
    static Sum e() { return {0}; }
    static Sum inv(Sum x) { return {-x.val}; }
    friend bool operator==(const Sum &a, const Sum &b) { return a.val == b.val; }
};
Back to top page