According to my calculation, if b>1, then at least 4*b+2 nodes are needed to make b beauty. Is this calculation incorrect? If so, it would be helpful if someone provides a counter case
Most of the codes i say have used that if ratio of n/b<4, then there is no such tree.
I think case of 4 1 will give a counter case for you.
Input
1
4 1
Output
YES
2 1
4 2
3 1
Case 2:
Input
1
8 2
Output
YES
2 1
3 2
6 3
7 3
8 3
4 1
5 4
1 Like
Actually, my calculation was for b>1 . I mentioned it in my post
For b=2, you need 10 nodes. But we can do with 8.
I just did, check now
Thanks, got it
Can anyone provide an editorial of this question pls?
1 Like