http://codeforces.net/problemset/problem/543/D↵
↵
I did not understand the editorial so I wrote a solution of my own. But I don't understand the tricky cases where it fails. ↵
Here is my submission ID [submission:11679268] . My logic is simple:↵
↵
1. Do DFS with "1" as root , store results in dp[i]↵
↵
2. result[1]=dp[1]↵
↵
3. result[i]=(1 + result[parent_of_i]/(dp[i]+1)) * dp[i] % mod;↵
↵
Where is the logic wrong? I couldn't figure it out.
↵
I did not understand the editorial so I wrote a solution of my own. But I don't understand the tricky cases where it fails. ↵
Here is my submission ID [submission:11679268] . My logic is simple:↵
↵
1. Do DFS with "1" as root , store results in dp[i]↵
↵
2. result[1]=dp[1]↵
↵
3. result[i]=(1 + result[parent_of_i]/(dp[i]+1)) * dp[i] % mod;↵
↵
Where is the logic wrong? I couldn't figure it out.