@@ -7,7 +7,7 @@ using namespace std;
7
7
#define RIGHT (n ) ( (n << 1 )|1 )
8
8
9
9
const int INSERTION = 0 , QUERY = 1 , MAX_N = 1e6 + 5 , OLD_LAST_OCCURENCE = 0 , NEW_LAST_OCCURENCE = 1 ;
10
- int tree [3 *MAX_N];
10
+ int sum_tree [3 *MAX_N];
11
11
12
12
struct info
13
13
{
@@ -37,9 +37,9 @@ void insert(int n, int left, int right, int position, int position_type)
37
37
if (left == right)
38
38
{
39
39
if (position_type == OLD_LAST_OCCURENCE)
40
- tree [n] = 0 ;
40
+ sum_tree [n] = 0 ;
41
41
else if (position_type == NEW_LAST_OCCURENCE)
42
- tree [n] = 1 ;
42
+ sum_tree [n] = 1 ;
43
43
44
44
return ;
45
45
}
@@ -51,7 +51,7 @@ void insert(int n, int left, int right, int position, int position_type)
51
51
else if (position > mid)
52
52
insert (RIGHT (n), mid + 1 , right, position, position_type);
53
53
54
- tree [n] = tree [LEFT (n)] + tree [RIGHT (n)];
54
+ sum_tree [n] = sum_tree [LEFT (n)] + sum_tree [RIGHT (n)];
55
55
}
56
56
57
57
int query (int n, int left, int right, int query_left, int query_right)
@@ -60,7 +60,7 @@ int query(int n, int left, int right, int query_left, int query_right)
60
60
return 0 ;
61
61
62
62
if (query_left <= left && right <= query_right)
63
- return tree [n];
63
+ return sum_tree [n];
64
64
65
65
int mid = (left + right) >> 1 ;
66
66
@@ -72,7 +72,7 @@ int query(int n, int left, int right, int query_left, int query_right)
72
72
73
73
int main ()
74
74
{
75
- memset (tree , 0 , sizeof (tree ));
75
+ memset (sum_tree , 0 , sizeof (sum_tree ));
76
76
77
77
vector <info> event;
78
78
0 commit comments