This documentation is automatically generated by online-judge-tools/verification-helper
#include "algebra/monoid/monoid_max_index.hpp"#pragma once
#include "../../algebra/value_index.hpp"
template <class T, T inf, bool smaller_index> struct MonoidMaxIndex {
using value_type = ValueIndex<T>;
static constexpr value_type operation(const value_type& a,
const value_type& b) {
if (a.v > b.v) return a;
if (a.v < b.v) return b;
bool is_small = smaller_index ? (a.i < b.i) : (a.i >= b.i);
return is_small ? a : b;
}
static constexpr value_type identity() noexcept { return {-inf, -1}; }
static constexpr bool commutative = true;
};#line 2 "algebra/monoid/monoid_max_index.hpp"
#line 2 "algebra/value_index.hpp"
template <class T> struct ValueIndex {
T v;
int i;
friend std::ostream& operator<<(std::ostream& os, const ValueIndex& x) {
return os << x.v;
}
};
#line 4 "algebra/monoid/monoid_max_index.hpp"
template <class T, T inf, bool smaller_index> struct MonoidMaxIndex {
using value_type = ValueIndex<T>;
static constexpr value_type operation(const value_type& a,
const value_type& b) {
if (a.v > b.v) return a;
if (a.v < b.v) return b;
bool is_small = smaller_index ? (a.i < b.i) : (a.i >= b.i);
return is_small ? a : b;
}
static constexpr value_type identity() noexcept { return {-inf, -1}; }
static constexpr bool commutative = true;
};