This documentation is automatically generated by online-judge-tools/verification-helper
#include "cpp/algebraic_structure/group.hpp"群は集合と二項演算の組であって、以下の条件を満たす。
Group g()
引数がない場合、単位元で初期化するものとする。
Group op(Group a, Group b)
演算 $a \cdot b$ を行う。
Group e()
単位元を返す。
Group g.inv()
$g$ の逆元を返す。
| クラス名 | 対象の集合 | 二項演算 | 単位元 | 逆元 |
|---|---|---|---|---|
GroupSum |
整数、実数など | 加算 | $0$ | $-x$ |
GroupMul |
整数、実数など(0を除く) | 乗算 | $1$ | $\frac{1}{x}$ |
GroupAffine |
アフィン写像 $y=a x + b$ | 合成 $y = a_1 (a_2 x + b) + b$ | $y = x$ | $ y = \frac{x}{a} - \frac{b}{a} $ |
#pragma once
#include "template/small_template.hpp"
template <class T = ll> class GroupSum {
T _x;
public:
GroupSum(T x_) : _x(x_) {}
GroupSum() : GroupSum(e()) {}
T x() const { return _x; }
static GroupSum e() { return 0; }
friend GroupSum op(const GroupSum &a, const GroupSum &b) {
return a._x + b._x;
}
GroupSum inv() const { return -_x; }
};
template <class T = ll> class GroupMul {
T _x;
public:
GroupMul(T x) : _x(x) { assert(x != 0); }
GroupMul() : GroupMul(e()) {}
T x() const { return _x; }
static GroupMul e() { return 1; }
friend GroupMul op(const GroupMul &a, const GroupMul &b) {
return a._x * b._x;
}
GroupMul inv() const { return 1 / _x; }
};
// アフィン写像 y = ax + b
template <class T = ll> class GroupAffine {
T _a, _b;
public:
GroupAffine(T a, T b) : _a(a), _b(b) {}
GroupAffine() : GroupAffine(e()) {}
T a() const { return _a; }
T b() const { return _b; }
static GroupAffine e() { return {1, 0}; }
friend GroupAffine op(const GroupAffine &p, const GroupAffine &q) {
return {p._a * q._a, p._b * q._a + q._b};
}
GroupAffine inv() const { return {1 / _a, -_b / _a}; }
T apply(const T &x) const { return _a * x + _b; }
};Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
bundler.update(path)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
self.update(self._resolve(pathlib.Path(included), included_from=path))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 260, in _resolve
raise BundleErrorAt(path, -1, "no such header")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: template/small_template.hpp: line -1: no such header