GCC Code Coverage Report


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

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