dsalgo/
segment_tree_lazy_i64_range_add_range_sum.rs1use crate::segment_tree_lazy_with_instance_homomorphism::*;
2
3pub struct RangeAddRangeSumI64;
4
5impl Ops for RangeAddRangeSumI64 {
6 type F = i64;
7
8 type S = (i64, i64);
9
10 fn op(
11 &self,
12 a: Self::S,
13 b: Self::S,
14 ) -> Self::S {
15 (a.0 + b.0, a.1 + b.1)
16 }
17
18 fn e(&self) -> Self::S {
19 (0, 0)
20 }
21
22 fn compose(
23 &self,
24 f: Self::F,
25 g: Self::F,
26 ) -> Self::F {
27 f + g
28 }
29
30 fn id(&self) -> Self::F {
31 0
32 }
33
34 fn map(
35 &self,
36 f: Self::F,
37 x: Self::S,
38 ) -> Self::S {
39 (x.0 + f * x.1, x.1)
40 }
41}
42
43#[cfg(test)]
44
45mod tests {
46
47 #[test]
48
49 fn test() {}
50}