GCC Code Coverage Report


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

test/cpv/library-checker-datastructure/range_affine_range_sum.mints-bs.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/bs/lib.hpp"
9
10 using namespace tifa_libs;
11 using mint = mint_bs<MOD>;
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
1/2
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
19 std::cin.tie(nullptr)->std::ios::sync_with_stdio(false);
25 u32 n, q;
26
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;
27
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 vec<T> a(n);
28
2/2
✓ Branch 6 taken 2407146 times.
✓ Branch 7 taken 19 times.
2407165 for (auto& x : a) std::cin >> x.first, x.second = 1;
29 19 tifa_libs::segtree<T, op, F, mapping, composition> segt({0, 0}, {1, 0}, a);
30
2/2
✓ Branch 0 taken 2718766 times.
✓ Branch 1 taken 19 times.
2718785 flt_ (u32, i, 1, q + 1) {
31 u32 opt, l, r;
32
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;
33
2/2
✓ Branch 0 taken 1359136 times.
✓ Branch 1 taken 1359630 times.
2718766 if (opt == 0) {
34 1359136 mint x, y;
35 1359136 std::cin >> x >> y;
36 1359136 segt.update(l, r, F{x, y});
37 } else
38
1/2
✓ Branch 3 taken 1359630 times.
✗ Branch 4 not taken.
1359630 std::cout << segt.query(l, r).first << '\n';
39 }
40 19 return 0;
41 19 }
42