segment_tree_interface

ソースコード

from titan_pylib.data_structures.segment_tree.segment_tree_interface import SegmentTreeInterface

view on github

展開済みコード

 1# from titan_pylib.data_structures.segment_tree.segment_tree_interface import SegmentTreeInterface
 2from abc import ABC, abstractmethod
 3from typing import TypeVar, Generic, Union, Iterable, Callable
 4
 5T = TypeVar("T")
 6
 7
 8class SegmentTreeInterface(ABC, Generic[T]):
 9
10    @abstractmethod
11    def __init__(self, n_or_a: Union[int, Iterable[T]], op: Callable[[T, T], T], e: T):
12        raise NotImplementedError
13
14    @abstractmethod
15    def set(self, k: int, v: T) -> None:
16        raise NotImplementedError
17
18    @abstractmethod
19    def get(self, k: int) -> T:
20        raise NotImplementedError
21
22    @abstractmethod
23    def prod(self, l: int, r: int) -> T:
24        raise NotImplementedError
25
26    @abstractmethod
27    def all_prod(self) -> T:
28        raise NotImplementedError
29
30    @abstractmethod
31    def max_right(self, l: int, f: Callable[[T], bool]) -> int:
32        raise NotImplementedError
33
34    @abstractmethod
35    def min_left(self, r: int, f: Callable[[T], bool]) -> int:
36        raise NotImplementedError
37
38    @abstractmethod
39    def tolist(self) -> list[T]:
40        raise NotImplementedError
41
42    @abstractmethod
43    def __getitem__(self, k: int) -> T:
44        raise NotImplementedError
45
46    @abstractmethod
47    def __setitem__(self, k: int, v: T) -> None:
48        raise NotImplementedError
49
50    @abstractmethod
51    def __str__(self):
52        raise NotImplementedError
53
54    @abstractmethod
55    def __repr__(self):
56        raise NotImplementedError

仕様

class SegmentTreeInterface(n_or_a: int | Iterable[T], op: Callable[[T, T], T], e: T)[source]

Bases: ABC, Generic[T]

abstractmethod all_prod() T[source]
abstractmethod get(k: int) T[source]
abstractmethod max_right(l: int, f: Callable[[T], bool]) int[source]
abstractmethod min_left(r: int, f: Callable[[T], bool]) int[source]
abstractmethod prod(l: int, r: int) T[source]
abstractmethod set(k: int, v: T) None[source]
abstractmethod tolist() list[T][source]