rcpl

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

View the Project on GitHub ruthen71/rcpl

:heavy_check_mark: algebra/acted_monoid/acted_monoid_plus_assign.hpp

Depends on

Verified with

Code

#pragma once

#include "../monoid/monoid_assign.hpp"
#include "../monoid/monoid_plus.hpp"

template <class T, T none> struct ActedMonoidPlusAssign {
    using MS = MonoidPlus<T>;
    using MF = MonoidAssign<T, none>;
    using S = typename MS::value_type;
    using F = typename MF::value_type;
    static constexpr S mapping(const F f, const S x, const int size) {
        if (f == MF::identity()) {
            return x;
        }
        return f * T(size);
    }
};
#line 2 "algebra/acted_monoid/acted_monoid_plus_assign.hpp"

#line 2 "algebra/monoid/monoid_assign.hpp"

template <class T, T none> struct MonoidAssign {
    using value_type = T;
    static constexpr T operation(const T& a, const T& b) noexcept {
        if (b == identity()) {
            return a;
        }
        return b;
    }
    static constexpr T identity() noexcept { return none; }
    static constexpr bool commutative = false;
};
#line 2 "algebra/monoid/monoid_plus.hpp"

template <class T> struct MonoidPlus {
    using value_type = T;
    static constexpr T operation(const T& a, const T& b) noexcept {
        return a + b;
    }
    static constexpr T identity() noexcept { return T(0); }
    static constexpr T inverse(const T& a) noexcept { return -a; }
    static constexpr bool commutative = true;
};
#line 5 "algebra/acted_monoid/acted_monoid_plus_assign.hpp"

template <class T, T none> struct ActedMonoidPlusAssign {
    using MS = MonoidPlus<T>;
    using MF = MonoidAssign<T, none>;
    using S = typename MS::value_type;
    using F = typename MF::value_type;
    static constexpr S mapping(const F f, const S x, const int size) {
        if (f == MF::identity()) {
            return x;
        }
        return f * T(size);
    }
};
Back to top page