This documentation is automatically generated by competitive-verifier/competitive-verifier
#include "tools/groups.hpp"They are typical groups.
template <typename G> struct groups::bit_xor;
It is a group $(G, \oplus, 0)$.
tools::commutative_group<tools::groups::bit_xor<G>> holds.using T = G;
It is an alias for <G>.
static G op(G x, G y);
It returns x ^ y.
x ^ y
static G e();
It returns G(0).
G(0)
static G inv(G x);
It returns x.
G(x)
template <typename G> struct groups::multiplies;
It is a group $(G, \times, 1)$.
tools::group<tools::groups::multiplies<G>> holds.using T = G;
It is an alias for <G>.
static G op(G x, G y);
It returns x * y.
x * y
static G e();
It returns G(1).
G(1)
static G inv(G x);
It returns G(1) / x.
G(1) / x
template <typename G> struct groups::plus;
It is a group $(G, +, 0)$.
tools::commutative_group<tools::groups::plus<G>> holds.using T = G;
It is an alias for <G>.
static G op(G x, G y);
It returns x + y.
x + y
static G e();
It returns G(0).
G(0)
static G inv(G x);
It returns -x.
-x
#ifndef TOOLS_GROUPS_HPP
#define TOOLS_GROUPS_HPP
#include <cstddef>
#include <type_traits>
#include "tools/arithmetic.hpp"
namespace tools {
namespace groups {
template <typename G>
struct bit_xor {
using T = G;
static T op(const T& x, const T& y) {
return x ^ y;
}
static T e() {
return T(0);
}
static T inv(const T& x) {
return x;
}
};
template <typename G>
struct multiplies {
using T = G;
static T op(const T& x, const T& y) {
return x * y;
}
static T e() {
return T(1);
}
static T inv(const T& x) {
return e() / x;
}
};
template <typename G>
struct plus {
using T = G;
static T op(const T& x, const T& y) {
return x + y;
}
static T e() {
return T(0);
}
static T inv(const T& x) {
return -x;
}
};
}
}
#endif
#line 1 "tools/groups.hpp"
#include <cstddef>
#include <type_traits>
#line 1 "tools/arithmetic.hpp"
#include <concepts>
#line 1 "tools/integral.hpp"
#line 1 "tools/is_integral.hpp"
#line 5 "tools/is_integral.hpp"
namespace tools {
template <typename T>
struct is_integral : std::is_integral<T> {};
template <typename T>
inline constexpr bool is_integral_v = tools::is_integral<T>::value;
}
#line 5 "tools/integral.hpp"
namespace tools {
template <typename T>
concept integral = tools::is_integral_v<T>;
}
#line 6 "tools/arithmetic.hpp"
namespace tools {
template <typename T>
concept arithmetic = tools::integral<T> || std::floating_point<T>;
}
#line 7 "tools/groups.hpp"
namespace tools {
namespace groups {
template <typename G>
struct bit_xor {
using T = G;
static T op(const T& x, const T& y) {
return x ^ y;
}
static T e() {
return T(0);
}
static T inv(const T& x) {
return x;
}
};
template <typename G>
struct multiplies {
using T = G;
static T op(const T& x, const T& y) {
return x * y;
}
static T e() {
return T(1);
}
static T inv(const T& x) {
return e() / x;
}
};
template <typename G>
struct plus {
using T = G;
static T op(const T& x, const T& y) {
return x + y;
}
static T e() {
return T(0);
}
static T inv(const T& x) {
return -x;
}
};
}
}