test/cpv/library-checker-datastructure/point_set_range_composite.mintd-bd.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #define AUTO_GENERATED | ||
| 2 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/point_set_range_composite | ||
| 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/bd/lib.hpp" | ||
| 9 | |||
| 10 | using namespace tifa_libs; | ||
| 11 | using mint = mint_bd<__LINE__>; | ||
| 12 | using Ty = mint; | ||
| 13 | using T = std::pair<Ty, Ty>; | ||
| 14 | using F = T; | ||
| 15 | |||
| 16 | 74036823 | auto op(T a, T b) { // b(a(x)) | |
| 17 | 74036823 | std::swap(a, b); | |
| 18 | 74036823 | return T{a.first * b.first, a.first * b.second + a.second}; | |
| 19 | } | ||
| 20 | ✗ | void mapping(T& a, F f) { a = op(f, a); } | |
| 21 | ✗ | void composition(F& x, F) { x = F(1, 0); } | |
| 22 | |||
| 23 | 16 | int main() { | |
| 24 | 16 | mint::set_mod(MOD); | |
| 25 |
1/2✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
|
16 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 26 | u32 n, q; | ||
| 27 |
2/4✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
|
16 | std::cin >> n >> q; |
| 28 |
1/2✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
|
16 | vec<T> a(n); |
| 29 |
2/2✓ Branch 7 taken 4112476 times.
✓ Branch 8 taken 16 times.
|
4112492 | for (auto& x : a) std::cin >> x.first >> x.second; |
| 30 | 16 | tifa_libs::segtree<T, op, F, mapping, composition> seg({1, 0}, {1, 0}, a); | |
| 31 |
2/2✓ Branch 0 taken 3836138 times.
✓ Branch 1 taken 16 times.
|
3836154 | for (u32 i = 0, opt; i < q; ++i) { |
| 32 |
1/2✓ Branch 1 taken 3836138 times.
✗ Branch 2 not taken.
|
3836138 | std::cin >> opt; |
| 33 |
2/2✓ Branch 0 taken 1916669 times.
✓ Branch 1 taken 1919469 times.
|
3836138 | if (opt == 0) { |
| 34 | u32 x; | ||
| 35 | 1916669 | Ty y, z; | |
| 36 |
1/2✓ Branch 1 taken 1916669 times.
✗ Branch 2 not taken.
|
1916669 | std::cin >> x >> y >> z; |
| 37 | 1916669 | seg.set(x, T{y, z}); | |
| 38 | } else { | ||
| 39 | u32 x, y; | ||
| 40 | 1919469 | Ty z; | |
| 41 |
2/4✓ Branch 1 taken 1919469 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1919469 times.
✗ Branch 5 not taken.
|
1919469 | std::cin >> x >> y >> z; |
| 42 | 1919469 | auto ret = seg.query(x, y); | |
| 43 |
1/2✓ Branch 4 taken 1919469 times.
✗ Branch 5 not taken.
|
1919469 | std::cout << ret.first * z + ret.second << '\n'; |
| 44 | } | ||
| 45 | } | ||
| 46 | 16 | return 0; | |
| 47 | 16 | } | |
| 48 |