byslib-python

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

View the Project on GitHub bayashi-cl/byslib-python

:warning: Modarray
(byslib/numeric/modarray.py)

Code

# @title Modarray
from array import array


def using_modarray(modulo: int):
    """Set modulo to modarray class.

    Parameters
    ----------
    modulo

    Returns
    -------
        modarray class mod is modulo
    """

    class ModArray(array):
        """Mod Array
        Take a mod for every assignment.
        """

        __slots__ = ()
        mod: int = modulo

        @classmethod
        def zeros(cls, n: int) -> "ModArray":
            return cls("L", [0] * n)

        def __setitem__(self, index, value) -> None:
            super().__setitem__(index, value % self.mod)

        def inv(self, index: int) -> int:
            return pow(self[index], self.mod - 2, self.mod)

    return ModArray


modarray998244353 = using_modarray(998244353)
modarray1000000007 = using_modarray(1000000007)
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/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], 'release': True}).decode()
  File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/site-packages/onlinejudge_verify/languages/python.py", line 80, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page