procon_lib_rs

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

View the Project on GitHub CoCo-Japan-pan/procon_lib_rs

:warning: crates/utils/monoid_utils/src/lib.rs

Depends on

Required by

Code

//! よくつかうモノイド達

use algebra::{Commutative, IdempotentMonoid, Monoid};
use internal_type_traits::Integral;
use std::marker::PhantomData;

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct MaxMonoid<T: Integral>(PhantomData<T>);

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct MinMonoid<T: Integral>(PhantomData<T>);

impl<T: Integral> Monoid for MaxMonoid<T> {
    type Target = T;
    fn id_element() -> Self::Target {
        T::min_value()
    }
    fn binary_operation(a: &Self::Target, b: &Self::Target) -> Self::Target {
        *a.max(b)
    }
}
impl<T: Integral> Commutative for MaxMonoid<T> {}
impl<T: Integral> IdempotentMonoid for MaxMonoid<T> {}

impl<T: Integral> Monoid for MinMonoid<T> {
    type Target = T;
    fn id_element() -> Self::Target {
        T::max_value()
    }
    fn binary_operation(a: &Self::Target, b: &Self::Target) -> Self::Target {
        *a.min(b)
    }
}
impl<T: Integral> Commutative for MinMonoid<T> {}
impl<T: Integral> IdempotentMonoid for MinMonoid<T> {}
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/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.13.9/x64/lib/python3.13/site-packages/onlinejudge_verify/languages/rust.py", line 288, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page