ICPC Amritpuri Regional Problem A Analysis

Revision en2, by MathLimitExceeded, 2016-12-25 14:38:49

I was trying to solve problem A from the recently conducted ICPC regional contest.

My approach was to use the following DP transition state — dp(i)(j) denotes the number of ways to assign labels to the subtree rooted at node i such that node i is given the label j.

I came up with the following transition for this state

where is the binomial coefficient, li and ri are the left and right child of i and si denotes the size of the sub-tree rooted at i.

According to me the time complexity of this algorithm is if I use prefix and suffix sums in the summation but it seems that this solution gets accepted. Can someone help show me how?

Tags acm, icpc, math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English MathLimitExceeded 2016-12-25 14:38:49 49
en1 English MathLimitExceeded 2016-12-25 14:36:50 876 Initial revision (published)