Skip to content

Commit b9401ed

Browse files
fix issue
1 parent 52af35d commit b9401ed

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

solutions/platinum/apio-19-bridges.mdx

+10-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ there are $\mathcal{O}(\sqrt N)$ updates or calculations. For each block:
2929
- To achieve this, we simply use DSU with path balancing only and keep a
3030
stack of previous DSU operations
3131

32-
The complexity of this algorithm is thus $\mathcal{O}((Q + M) \sqrt Q)$. Some
33-
constant-factor optimization may be needed to get this to run in time though.
34-
3532
## Implementation
3633

34+
**Time Complexity:** $\mathcal{O}((Q + M) \log N \sqrt Q )$
35+
36+
However, it is possible to remove the log factor as mentioned in [this comment](https://codeforces.com/blog/entry/67129?#comment-514312).
37+
38+
<LanguageSection>
39+
<CPPSection>
40+
3741
```cpp
3842
#include <bits/stdc++.h>
3943
#define FOR(i, x, y) for (int i = x; i < y; i++)
@@ -130,6 +134,8 @@ int main() {
130134
}
131135

132136
FOR(i, 1, q + 1) if (t[i] == 2) cout << ans[i] << '\n';
133-
return 0;
134137
}
135138
```
139+
140+
</CPPSection>
141+
</LanguageSection>

0 commit comments

Comments
 (0)