Appleman and tree Code

Problem Statement:
https://codeforces.com/problemset/problem/461/B

I need code for the condition when number of components where root node is black i.e. dp[node][1]

and also given that this time, [node] is white.

so the recurrence relation would be like:
dp[i][1] = Sum of ( dp[it][1] * ( dp[i][0] / ( dp[it][0] + dp[it][1] ) ) )

My doubt is, I didn’t aware of this inverse function. Can anyone know about the Inverse function or have some resources about this function?

hey refer this blog for more information about inverse function:https://www.geeksforgeeks.org/inverse-functions-and-composition-of-functions/

It’s not helpful. I have already read that blog.

If you didn’t code or understand the problem then please don’t take this doubt. In the worst case scenario, you hold the doubt for too long and you didn’t response it either. What’s wrong with you, buddy!

what do you not understand about inverse functions?

Okay…tell me one thing, why we’re applying inverse function in this problem? What’s the purpose of this inverse function in this problem?
If you can give the answer of my question then we’ll talk further.

inverse function is used to expand the modulo function here as it has divide in it .modulo division has to be in terms of inverse of modulo.
u can go to number theory to see this further
this is clearly taught in the video watch it again and try to understand when u reply tag me using@+‘username’ so that i get a notification of your replies.if you have any other query do let me know .

No it isn’t. Can you again tell me topic name of that video where this inverse modulo function taught explicitly in number theory. I didn’t see it.

But most important thing,

I’m sorry, why should I tag you if you have already taken my doubt.
But if you’re not taken it then just leave my thread.

coding-appleman-and-tree-codeforces-dp-on-tree is the video
tags give notifications of the student’s replies
if you dont find this satisfactory , please close the doubt and create a new one so a better ta can help u :slight_smile: