/tmp/solutions/build/point_add_range_sum-main.cpp:
1| |#include <common.h>
2| |prelude;
3| |
4| |u64 a[500001];
5| |
6| 21|int main() {
7| 21| rd rd;
8| 21| wt wt;
9| 21| int n = rd.uh();
10| 21| int q = rd.uh();
11| 4.11M| for (int i = 1; i <= n; ++i) a[i] = a[i - 1] + rd.uw();
^4.11M^4.11M
------------------
| Branch (11:19): [True: 100.00%, False: 0.00%]
------------------
12| 4.11M| for (int i = n; i >= 1; --i) a[i] -= a[i - (i & -i)];
^4.11M^4.11M
------------------
| Branch (12:19): [True: 100.00%, False: 0.00%]
------------------
13| 3.84M| while (q--) {
------------------
| Branch (13:10): [True: 100.00%, False: 0.00%]
------------------
14| 3.84M| let t = rd.u1();
15| 3.84M| if (t == 0) {
------------------
| Branch (15:9): [True: 49.98%, False: 50.02%]
------------------
16| 1.91M| int k = rd.uh() + 1;
17| 1.91M| int x = rd.uw();
18| 20.0M| for (; k <= n; k += k & -k) a[k] += x;
^18.1M ^18.1M
------------------
| Branch (18:14): [True: 90.43%, False: 9.57%]
------------------
19| 1.91M| }
20| 3.84M| if (t == 1) {
------------------
| Branch (20:9): [True: 50.02%, False: 49.98%]
------------------
21| 1.92M| int l = rd.uh();
22| 1.92M| int r = rd.uh();
23| 1.92M| u64 ans = 0;
24| 18.7M| for (int k = l; k > 0; k -= k & -k) ans -= a[k];
^16.7M ^16.7M
------------------
| Branch (24:23): [True: 89.73%, False: 10.27%]
------------------
25| 20.2M| for (int k = r; k > 0; k -= k & -k) ans += a[k];
^18.3M ^18.3M
------------------
| Branch (25:23): [True: 90.52%, False: 9.48%]
------------------
26| 1.92M| wt.ud(ans);
27| 1.92M| }
28| 3.84M| }
29| 21| return 0;
30| 21|}