POJ2891: Strange Way to Express Integers — Solution
Well, for a math scrub like me, writing math problems really is a miserable experience.
Continue reading →Chinese original · English translation by Claude Opus 5.5
Well, for a math scrub like me, writing math problems really is a miserable experience.
Continue reading →Chinese original · English translation by Claude Opus 5.5
After reading this solution I AC’d it right away. It really is a very concise approach.
Continue reading →Chinese original · English translation by Claude Opus 5.5
The expression in this problem can be simplified to:
Continue reading →Chinese original · English translation by Claude Opus 5.5
The first question is still pretty easy to answer: use \(O(n^2)\) time to do the DP for the longest decreasing subsequence. For the second question, we can set up an array \(g[]\) to store the number of ways. The transition equation can be derived quite obviously as:
Continue reading →Chinese original · English translation by Claude Opus 5.5
The first equation for this problem is actually very obvious, namely \(f[i] = max\{f[i], j\}, number(f[j-1], j-1)<number(j,i)\). The second equation really just restructures the state a bit; it's about the same as the original \(f[]\), with the transition \(dp[i] = max\{dp[i], j\}, number(i,j)<number(j+1, dp[j+1)\). Note that this problem needs a big-integer comparison, otherwise it'll go gg (I spent half an hour debugging this thing).
Continue reading →Chinese original · English translation by Claude Opus 5.5
This problem is actually modeled in much the same way as LOJ 6002; it just adds a binary search on the answer to build the graph dynamically. See the code:
Continue reading →Chinese original · English translation by Claude Opus 5.5
Idiotic problems, no analysis.
Continue reading →Chinese original · English translation by Claude Opus 5.5
So godlike.
Continue reading →Chinese original · English translation by Claude Opus 5.5
This is a problem that leans toward thinking; I guess in the eyes of a big shot it's the kind of problem that gets insta-solved. We can split the three lines into two cases:
Continue reading →Chinese original · English translation by Claude Opus 5.5
A ridiculously easy problem: just do two linear DFS passes and merge the distances.
Continue reading →Chinese original · English translation by Claude Opus 5.5