Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSES - New Roads Queries Solution #4636

Open
Oz121 opened this issue Jul 20, 2024 · 2 comments
Open

CSES - New Roads Queries Solution #4636

Oz121 opened this issue Jul 20, 2024 · 2 comments
Labels
content content-related issue good first issue Good for newcomers

Comments

@Oz121
Copy link

Oz121 commented Jul 20, 2024

For this problem, the solution given (https://usaco.guide/problems/cses-2101-new-roads-queries/solution) uses Platinum topics.

There's a more elementary solution with parallel binary search here: https://duoblogger.github.io/assets/pdf/memonvyftw/guide-t-cp.pdf (section 15.5.3). Also, the top user solution uses parallel binary search.

@bqi343 bqi343 added the content content-related issue label Jul 20, 2024
@bqi343
Copy link
Member

bqi343 commented Jul 21, 2024

another way (though not simpler) is to convert the tree into a line, then it reduces to RMQ queries which can be answered in $O(1)$ time each.

ref: https://codeforces.com/blog/entry/71568?#comment-559304

@bqi343 bqi343 added the good first issue Good for newcomers label Jul 21, 2024
@TheGamingMousse
Copy link
Contributor

we can also use dsu stuff described in the solution to this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content content-related issue good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants