problemset/problem/543/D
Difference between en1 and en2, changed 6 character(s)
http://codeforces.com/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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English I_love_Captain_America 2015-06-20 14:51:33 6
en1 English I_love_Captain_America 2015-06-20 14:49:18 461 Initial revision (published)