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