GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 21 / 0 / 21
Functions: 100.0% 4 / 0 / 4
Branches: 63.6% 14 / 0 / 22

test/cpv/library-checker-datastructure/range_affine_range_sum.mintd-md.cpp
Line Branch Exec Source
1 #define AUTO_GENERATED
2 // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/range_affine_range_sum
3 #include "../../../src/ds/segtree/hp/lib.hpp"
4
5 using namespace tifa_libs;
6 CEXP u32 MOD = 998244353;
7
8 #include "../../../src/math/ds/mint/md/lib.hpp"
9
10 using namespace tifa_libs;
11 using mint = mint_md<__LINE__>;
12 using T = std::pair<mint, usz>; // sum len
13 using F = std::pair<mint, mint>; // mul add
14
15 73731468 auto op(T a, T b) { return T{a.first + b.first, a.second + b.second}; }
16 155543469 auto mapping(T& a, F f) { a.first = f.first * a.first + f.second * a.second; }
17 80574496 auto composition(F& f, F g) {
18 80574496 f = F{f.first * g.first, g.first * f.second + g.second};
19 // g(x) = g.mul * x + g.add
20 // f(g(x)) = f.mul * (g.mul * x + g.add) + f.add = f.mul * g.mul * x + f.mul * g.add + f.add
21 80574496 }
22
23 19 int main() {
24 19 mint::set_mod(MOD);
25
1/2
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
19 std::cin.tie(nullptr)->std::ios::sync_with_stdio(false);
26 u32 n, q;
27
2/4
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
19 std::cin >> n >> q;
28
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 vec<T> a(n);
29
2/2
✓ Branch 6 taken 2407146 times.
✓ Branch 7 taken 19 times.
2407165 for (auto& x : a) std::cin >> x.first, x.second = 1;
30 19 tifa_libs::segtree<T, op, F, mapping, composition> segt({0, 0}, {1, 0}, a);
31
2/2
✓ Branch 0 taken 2718766 times.
✓ Branch 1 taken 19 times.
2718785 flt_ (u32, i, 1, q + 1) {
32 u32 opt, l, r;
33
3/6
✓ Branch 1 taken 2718766 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2718766 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2718766 times.
✗ Branch 8 not taken.
2718766 std::cin >> opt >> l >> r;
34
2/2
✓ Branch 0 taken 1359136 times.
✓ Branch 1 taken 1359630 times.
2718766 if (opt == 0) {
35 1359136 mint x, y;
36 1359136 std::cin >> x >> y;
37 1359136 segt.update(l, r, F{x, y});
38 } else
39
1/2
✓ Branch 3 taken 1359630 times.
✗ Branch 4 not taken.
1359630 std::cout << segt.query(l, r).first << '\n';
40 }
41 19 return 0;
42 19 }
43