Skip to content

Commit 176ad1d

Browse files
committed
modify code
1 parent 5fe8f9c commit 176ad1d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/class174/Code04_Bridge1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public static void merge() {
143143
// 所有边的编号edge[1..m],按照边权从大到小排序
144144
// 处理当前操作块的所有操作
145145
public static void compute(int l, int r) {
146-
// 重建并查集,目前没有任何联通性
146+
// 重建并查集,目前没有任何连通性
147147
// 清空边的修改标记
148148
build();
149149
Arrays.fill(change, false);

src/class174/Code05_Lcm1.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ public static boolean check(int x, int y, int a, int b) {
117117
}
118118

119119
public static void compute(int l, int r) {
120+
// 重建并查集,目前没有任何连通性
120121
build();
122+
// 重要剪枝
123+
// 保证每条查询只在一个边的序列块中处理
121124
cursiz = 0;
122125
for (int i = 1; i <= q; i++) {
123-
// 保证每条查询只在一个边的序列块中处理
124126
if (ea[edge[l]] <= qa[query[i]] && (r + 1 > m || qa[query[i]] < ea[edge[r + 1]])) {
125127
cur[++cursiz] = query[i];
126128
}

0 commit comments

Comments
 (0)