This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub kmyk/competitive-programming-library
#include "monoids/linear_function.hpp"
#pragma once #include <utility> template <class CommutativeRing> struct linear_function_monoid { typedef std::pair<CommutativeRing, CommutativeRing> value_type; linear_function_monoid() = default; value_type unit() const { return std::make_pair(1, 0); } value_type mult(value_type g, value_type f) const { CommutativeRing fst = g.first * f.first; CommutativeRing snd = g.second + g.first * f.second; return std::make_pair(fst, snd); } };
#line 2 "monoids/linear_function.hpp" #include <utility> template <class CommutativeRing> struct linear_function_monoid { typedef std::pair<CommutativeRing, CommutativeRing> value_type; linear_function_monoid() = default; value_type unit() const { return std::make_pair(1, 0); } value_type mult(value_type g, value_type f) const { CommutativeRing fst = g.first * f.first; CommutativeRing snd = g.second + g.first * f.second; return std::make_pair(fst, snd); } };