New answers tagged

1

The provided editorial is so hard to read. My solution is similar (or not?) to the provided one, but easier to understand. Let $dp(u, i)$ be the number of topological sorts of subtree rooted at node $u$ such that node $u$ is placed at $i$-th position. The definition of $X$ and $Y$ are the same as the definition provided above. Note that all the $X$ nodes has ...


Top 50 recent answers are included