Skip to content

Commit 3af81a6

Browse files
Update XOR Segment Tree.cpp
1 parent d87abcd commit 3af81a6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Data Structures/XOR Segment Tree.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ using namespace std;
33

44
const int N = 2e5 + 9;
55

6-
int a[N];
6+
using T = long long;
7+
T a[N];
78
struct XORSegmentTree {
8-
using T = long long;
99
// the length of the array should be 2^LOG for some LOG
1010
vector<T> t[4 * N]; // O(LOG 2^LOG) memory
1111
T lazy[4 * N];
@@ -78,14 +78,14 @@ int32_t main() {
7878
int z = rnd() % n, add = rnd() % 100;
7979
t.upd(1, 0, n - 1, z, add);
8080
a[z] += add;
81-
long long sum = 0;
81+
T sum = 0;
8282
for (int i = l; i <= r; i++) {
8383
sum += a[i ^ x];
8484
}
85-
long long res = t.query(1, 0, n - 1, l, r, x, k - 1);
85+
T res = t.query(1, 0, n - 1, l, r, x, k - 1);
8686
cout << sum << ' ' << res << '\n';
8787
assert(sum == res);
8888
}
8989
return 0;
9090
}
91-
// relevant problem: https://codeforces.com/contest/1654/problem/F
91+
// relevant problem: https://codeforces.com/contest/1654/problem/F

0 commit comments

Comments
 (0)