Luzhiled's Library

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub ei1333/library

:heavy_check_mark: structure/class/point-set-range-composite.hpp

Depends on

Verified with

Code

#include "affine.hpp"

template <typename T>
struct PointSetRangeComposite {
  using S = Affine<T>;
  static constexpr S op(const S& a, const S& b) { return S::op(a, b); }
  static constexpr S e() { return S(); }
};
#line 1 "structure/class/affine.hpp"
template <typename T>
struct Affine {
  T a, b;  // ax+b
  Affine() : a(1), b(0) {}
  Affine(T a, T b) : a(a), b(b) {}
  T eval(T x) const { return a * x + b; }
  static constexpr Affine op(const Affine& l, const Affine& r) {
    return {l.a * r.a, l.b * r.a + r.b};
  }
  constexpr bool operator==(const Affine& p) const {
    return a == p.a and b == p.b;
  }
  constexpr bool operator!=(const Affine& p) const {
    return a != p.a or b != p.b;
  }
};
#line 2 "structure/class/point-set-range-composite.hpp"

template <typename T>
struct PointSetRangeComposite {
  using S = Affine<T>;
  static constexpr S op(const S& a, const S& b) { return S::op(a, b); }
  static constexpr S e() { return S(); }
};
Back to top page