library

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

View the Project on GitHub maspypy/library

:heavy_check_mark: alg/monoid/maxidx.hpp

Required by

Verified with

Code

template <typename T, bool tie_is_left = true>
struct Monoid_MaxIdx {
  using value_type = pair<T, int>;
  using X = value_type;
  static X op(X x, X y) {
    if (x.fi > y.fi) return x;
    if (x.fi < y.fi) return y;
    if (x.se > y.se) swap(x, y);
    return (tie_is_left ? x : y);
  }
  static constexpr X unit() { return {-infty<T>, -1}; }
  static constexpr bool commute = true;
};
#line 1 "alg/monoid/maxidx.hpp"

template <typename T, bool tie_is_left = true>
struct Monoid_MaxIdx {
  using value_type = pair<T, int>;
  using X = value_type;
  static X op(X x, X y) {
    if (x.fi > y.fi) return x;
    if (x.fi < y.fi) return y;
    if (x.se > y.se) swap(x, y);
    return (tie_is_left ? x : y);
  }
  static constexpr X unit() { return {-infty<T>, -1}; }
  static constexpr bool commute = true;
};
Back to top page