/tmp/solutions/build/range_affine_point_get-main.cpp:
1| |#include <common.h>
2| |#include <toy/bit.h>
3| |prelude;
4| |
5| |namespace {
6| |
7| |constexpr int N = 1e6;
8| |constexpr int P = 998244353;
9| |
10| |struct node {
11| | u32 a, b;
12| 3.94k| auto operator+(node t) -> node {
13| 3.94k| return {u32(u64(t.a) * a % P), u32((u64(t.a) * b + t.b) % P)};
14| 3.94k| }
15| 856| auto operator+(u32 x) -> u32 { return (u64(a) * x + b) % P; }
16| 3.94k| auto operator+=(node t) -> void { *this = *this + t; }
17| |} a[N];
18| |
19| 994|void pushdown(int k) {
20| 2.63k| for (int i = log(k) - 1; i >= 0; --i) {
^1.64k
------------------
| Branch (20:28): [True: 62.29%, False: 37.71%]
------------------
21| 1.64k| node t = a[k >> i >> 1];
22| 1.64k| a[k >> i >> 1] = node{1, 0};
23| 1.64k| a[k >> i ^ 0] += t;
24| 1.64k| a[k >> i ^ 1] += t;
25| 1.64k| }
26| 994|}
27| |
28| |} // namespace
29| |
30| 1|int main() {
31| 1| rd rd;
32| 1| wt wt;
33| 1| int n = rd.uh();
34| 1| int q = rd.uh();
35| 4| for (int i = 0; i < n; ++i) a[i] = {1, 0}, a[n + i].b = rd.uw();
^3 ^3
------------------
| Branch (35:19): [True: 75.00%, False: 25.00%]
------------------
36| 1.00k| while (q--) {
------------------
| Branch (36:10): [True: 99.90%, False: 0.10%]
------------------
37| 1.00k| let t = rd.u1();
38| 1.00k| if (t == 0) {
------------------
| Branch (38:9): [True: 49.70%, False: 50.30%]
------------------
39| 497| int l = n + rd.uh();
40| 497| int r = n + rd.uh() - 1;
41| 497| node x = {rd.uw(), rd.uw()};
42| 497| pushdown(l--);
43| 497| pushdown(r++);
44| 497| int k = log(l ^ r);
45| 843| for (int t = ~l & ~(-1 << k), i; t > 0; t -= 1 << i) {
^346
------------------
| Branch (45:40): [True: 41.04%, False: 58.96%]
------------------
46| 346| i = log(t);
47| 346| a[l >> i ^ 1] += x;
48| 346| }
49| 814| for (int t = +r & ~(-1 << k), i; t > 0; t -= 1 << i) {
^317
------------------
| Branch (49:40): [True: 38.94%, False: 61.06%]
------------------
50| 317| i = log(t);
51| 317| a[r >> i ^ 1] += x;
52| 317| }
53| 497| }
54| 1.00k| if (t == 1) {
------------------
| Branch (54:9): [True: 50.30%, False: 49.70%]
------------------
55| 503| int k = n + rd.uh();
56| 503| u32 x = a[k].b;
57| 1.35k| for (k /= 2; k > 0; k /= 2) x = a[k] + x;
^856 ^856
------------------
| Branch (57:20): [True: 62.99%, False: 37.01%]
------------------
58| 503| wt.uw(x);
59| 503| }
60| 1.00k| }
61| 1| return 0;
62| 1|}