Skip to content

Commit 0762169

Browse files
committed
modify code
1 parent 5c09b2b commit 0762169

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/class182/Code04_SegmentTreeSplit1.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class Code04_SegmentTreeSplit1 {
3030
public static int[] ls = new int[MAXT];
3131
public static int[] rs = new int[MAXT];
3232
public static long[] sum = new long[MAXT];
33-
public static int cntRoot;
33+
public static int version;
3434

3535
public static int[] pool = new int[MAXT];
3636
public static int top;
@@ -162,10 +162,10 @@ public static void main(String[] args) throws Exception {
162162
prepare();
163163
n = in.nextInt();
164164
m = in.nextInt();
165-
cntRoot = 1;
165+
version = 1;
166166
for (int i = 1, x; i <= n; i++) {
167167
x = in.nextInt();
168-
root[cntRoot] = add(i, x, 1, n, root[1]);
168+
root[version] = add(i, x, 1, n, root[1]);
169169
}
170170
for (int i = 1, op, x, y, z; i <= m; i++) {
171171
op = in.nextInt();
@@ -175,7 +175,7 @@ public static void main(String[] args) throws Exception {
175175
z = in.nextInt();
176176
split(y, z, 1, n, root[x]);
177177
root[x] = tree1;
178-
root[++cntRoot] = tree2;
178+
root[++version] = tree2;
179179
} else if (op == 1) {
180180
x = in.nextInt();
181181
y = in.nextInt();

src/class182/Code04_SegmentTreeSplit2.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
//int ls[MAXT];
2626
//int rs[MAXT];
2727
//long long sum[MAXT];
28-
//int cntRoot;
28+
//int version;
2929
//
3030
//int pool[MAXT];
3131
//int top;
@@ -156,18 +156,18 @@
156156
// cin.tie(nullptr);
157157
// prepare();
158158
// cin >> n >> m;
159-
// cntRoot = 1;
159+
// version = 1;
160160
// for (int i = 1, x; i <= n; i++) {
161161
// cin >> x;
162-
// root[cntRoot] = add(i, x, 1, n, root[1]);
162+
// root[version] = add(i, x, 1, n, root[1]);
163163
// }
164164
// for (int i = 1, op, x, y, z; i <= m; i++) {
165165
// cin >> op;
166166
// if (op == 0) {
167167
// cin >> x >> y >> z;
168168
// split(y, z, 1, n, root[x]);
169169
// root[x] = tree1;
170-
// root[++cntRoot] = tree2;
170+
// root[++version] = tree2;
171171
// } else if (op == 1) {
172172
// cin >> x >> y;
173173
// root[x] = merge(1, n, root[x], root[y]);

0 commit comments

Comments
 (0)