Editorial for ICPC PACNW 2016 D - Contest Strategy
Submitting an official solution before solving the problem yourself is a bannable offence.
First, let's consider our expected penalty time, then multiply by to get the final answer. In this case, we can do "divisions" as multiplying by the inverse under the mod.
First, suppose we solve the problems in order ( is the index of the problem solved).
Then, the penalty time for this order can be written as:
Let's apply linearity of expectation to this, so we can see that the contribution of a problem to the penalty time only depends on its position. Namely, if the expected value of the position of the problem is , this contributes to our penalty.
Let's sort our problems in increasing order of time (if there are ties, break them by index). It suffices to compute → expected placement of the problem. This can be computed with dp.
Now, once we fix a problem, we only care about how many problems are easier to solve and harder to solve. We should keep track of how many easier are unread, how many harder are unread, how many easier are read, how many harder are read, and whether or not we have read the problem we're interested in. This can be summarized as → have unread easier problems, have unread harder problems, have easier read problems, if we have read the problem we're interested in and otherwise (note that number of harder read can be derived from the above variables). We can write the transition rules based on the problem statement.
Of course, this dp takes time to evaluate per position, which is too slow. Instead, we can note that a lot of the state is common across positions, so let's not reset the dp table in between positions. Thus, this shows that the total runtime is at most over all positions.
Comments