Skip to content

Conversation

IvanRenison
Copy link
Contributor

It breaks the case when P is empty, but thats not an useful case

It breaks the case when P is empty, but thats not an useful case
@simonlindholm
Copy link
Member

I don't care about the case of empty P, because that's not a tree, but I do care about sz(P) == 1. __lg(0) is undefined, right?

@IvanRenison
Copy link
Contributor Author

IvanRenison commented May 12, 2024

Oh, yes, I saw in this stack overflow answer that it's -1, and in my machine gives -1, but according to this codeforces blog you are right.
I fixed it with sz(P) < 2 ? 0 :1 + __lg(sz(P) - 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants