library

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

View the Project on GitHub gyouzasushi/library

:heavy_check_mark: Semiring: Max Plus
(algebra/semiring_max_plus.hpp)

Verified with

Code

#pragma once
#include <algorithm>
#include <limits>
template <class T>
struct semiring_max_plus {
    using S = T;
    static S add(S a, S b) {
        return std::max(a, b);
    }
    static S zero() {
        return std::numeric_limits<T>::lowest();
    }
    static S mul(S a, S b) {
        if (a == zero() || b == zero()) return zero();
        return a + b;
    }
    static S one() {
        return T(0);
    }
};
#line 2 "algebra/semiring_max_plus.hpp"
#include <algorithm>
#include <limits>
template <class T>
struct semiring_max_plus {
    using S = T;
    static S add(S a, S b) {
        return std::max(a, b);
    }
    static S zero() {
        return std::numeric_limits<T>::lowest();
    }
    static S mul(S a, S b) {
        if (a == zero() || b == zero()) return zero();
        return a + b;
    }
    static S one() {
        return T(0);
    }
};
Back to top page