Depth Against Density
A DP has states dp[i][r] with and , and every transition is . Instrumenting the recursion on the real inputs shows that from the start state only about 3000 of the states are ever reached. Limits: 2 seconds, 256 MB, and the default 8 MB stack.
Which implementation do you write?
Sign in to answer questions and track your progress
Sign In