File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
verify/structures/fenwick Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ namespace cp_algo::structures {
99 Container data;
1010
1111 fenwick (auto &&range) {
12- assign (range);
12+ assign (move ( range) );
1313 }
1414 void to_prefix_sums () {
1515 for (size_t i = 1 ; i < n; i++) {
Original file line number Diff line number Diff line change 1+ // @brief Point Add Range Sum
2+ #define PROBLEM " https://judge.yosupo.jp/problem/point_add_range_sum"
3+ #pragma GCC optimize("Ofast,unroll-loops")
4+ #include " cp-algo/structures/fenwick.hpp"
5+ #include < bits/stdc++.h>
6+
7+ using namespace std ;
8+
9+ void solve () {
10+ int n, q;
11+ cin >> n >> q;
12+ vector<int64_t > a (n + 1 );
13+ for (auto &it: a | views::drop (1 )) {cin >> it;}
14+ cp_algo::structures::fenwick<int64_t > me (move (a));
15+ for (int i = 0 ; i < q; i++) {
16+ int t, x, y;
17+ cin >> t >> x >> y;
18+ if (t == 0 ) {
19+ me.add (x, y);
20+ } else {
21+ cout << me.range_sum (x, y) << ' \n ' ;
22+ }
23+ }
24+ }
25+
26+ signed main () {
27+ // freopen("input.txt", "r", stdin);
28+ ios::sync_with_stdio (0 );
29+ cin.tie (0 );
30+ int t;
31+ t = 1 ;// cin >> t;
32+ while (t--) {
33+ solve ();
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments