Skip to content

Commit

Permalink
Merge pull request #4986 from Sosuke23/b
Browse files Browse the repository at this point in the history
minor add
  • Loading branch information
dongliuu authored Dec 16, 2024
2 parents d682708 + c7abbc1 commit bc47f4b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions solutions/platinum/cses-1750.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Planet Queries I
author: Dong Liu
---

**Time Complexity**: $\mathcal{O}(N\log N)$
## Explanation

Construct a parent matrix (where $\texttt{parent}[i][d]$ is the $2^d$th parent
of $i$). Then, we can answer each query by using
Expand All @@ -15,8 +15,11 @@ representation of the distance.
Since the query distances can be up to $10^9$, we set the maximum depth to
$\lceil{\log_2{10^9}}\rceil = 30$.

<LanguageSection>
## Implementation

**Time Complexity**: $\mathcal{O}(N\log N)$

<LanguageSection>
<CPPSection>

```cpp
Expand Down Expand Up @@ -56,5 +59,4 @@ int main() {
```

</CPPSection>

</LanguageSection>

0 comments on commit bc47f4b

Please sign in to comment.