rcpl

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

View the Project on GitHub ruthen71/rcpl

:warning: algebra/monoid_s_f/monoid_min_index_set.hpp

Depends on

Code

#pragma once
#include "algebra/monoid_s/monoid_min_index.hpp"
#include "algebra/monoid_f/monoid_set.hpp"
// MSF
template <class T, bool left = true> struct MonoidMinIndexSet {
    using MS = MonoidMinIndex<T, left>;
    using MF = MonoidSet<T>;
    using S = typename MS::S;
    using F = typename MF::F;
    static constexpr S mapping(F f, S x) { return f == MF::id() ? x : ({f, x.second}); }
};
#line 2 "algebra/monoid_s/monoid_min_index.hpp"
// MS
template <class T, bool left = true> struct MonoidMinIndex {
    using S = std::pair<T, int>;
    static constexpr S op(S a, S b) {
        if (a.first < b.first) return a;
        if (a.first > b.first) return b;
        if (a.second > b.second) std::swap(a, b);
        return (left ? a : b);
    }
    static constexpr S e() { return {std::numeric_limits<T>::max(), -1}; }
};
#line 2 "algebra/monoid_f/monoid_set.hpp"
// MF
template <class T> struct MonoidSet {
    using F = T;
    static constexpr F composition(F f, F g) { return f == id() ? g : f; }
    static constexpr F id() { return std::numeric_limits<F>::max(); }
};
#line 4 "algebra/monoid_s_f/monoid_min_index_set.hpp"
// MSF
template <class T, bool left = true> struct MonoidMinIndexSet {
    using MS = MonoidMinIndex<T, left>;
    using MF = MonoidSet<T>;
    using S = typename MS::S;
    using F = typename MF::F;
    static constexpr S mapping(F f, S x) { return f == MF::id() ? x : ({f, x.second}); }
};
Back to top page