| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | strapple | 3515 |
| 6 | tourist | 3470 |
| 7 | dXqwq | 3436 |
| 8 | Radewoosh | 3415 |
| 9 | Otomachi_Una | 3413 |
| 10 | Um_nik | 3376 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 157 |
| 2 | adamant | 153 |
| 3 | Um_nik | 146 |
| 3 | Proof_by_QED | 146 |
| 5 | Dominater069 | 145 |
| 6 | errorgorn | 141 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | TheScrasse | 134 |
| 10 | chromate00 | 133 |
|
0
Yes I saw that this doesn't work, but assume that you always pass the minimum distance (-1 if none exists) to a police station in your subtrees to your parent when you moving up the dfs tree. Now you only cut edges if the distances has exceeded d. So in your case we would have cut (1,2) when coming back from 2 to 1. And we cut as well if we arrive at a police station moving back up and some police station is present in the subtree. |
|
0
What is a counterexample to the greedy solution of D? I don't understand why this doesn't work. |
|
+4
As it took me ages to figure out the recurrence for DIV1.C. I hope this will clarify things for others. Somebody already mentioned above that the problem can be reduced to a non-decreasing sequence by considering the sequence ai - i. From now on we will just consider ai = ai - i. The second thing that one can prove is that there always exists an optimal solution, where one ai is not changed. Hint: Just consider an optimal solution where this does not hold. Let bi be the sorted sequence of ai. Let dpi, j be the optimal value for the prefix a1... ai while ending in a value smaller or equal to bj. The recurrence is then as follows dpi, j = min{ dpi, j - 1, dpi - 1, j + |bj - ai| } Why? Either we let the prefix a1... ai end in a value smaller then bj - 1 ( hence also smaller then bj) or we let the prefix a1... ai - 1 end in a value smaller or equal to bj and also let ai be equal to bj. There are some base cases and this can of course be adapted for linear space. Edit: 20669994 |
|
0
Could someone explain this testcase (which is the 37th) of Problem E? The output is NO for all edges except the two that lie on the unique shortest path of length 378, for which the answer is YES. What I don't understand is why the answer for all other edges is NO. Let's take for example the path (1 — 5 — 3 — 10 ) of length 470. The first and the last edge could be reduced by 93 to give a path of length 377 in which case they lie on the unique shortest path. I probably misunderstood something in the problem statement. Thanks in advance. |
|
0
Just two that came to mind are: convex hull and sweep line |
|
0
I understood everything up to the point you explain. But then the author does some jump which I am unable to follow, mainly how the same sum can be expressed differently in terms of bi's where bi is a good number. So what exacly am I supposed to compute in terms of bi's for a given ai and why is the transformation from the inclusion-exclusion formula to the bi formula correct? I feel like this editorial anwser is the perfect example where one has to dicipher half the anwser. |
|
0
Would you mind to elaborate a bit more? It's not clear to me. |
|
0
It works because you integrate the topsort in Kosaraju's algorithm. In general a topsort only works on DAG's. If somebody would implement Kosaraju and Topsort seperatly it might fail, maybe you should mention that in the write-up. Otherwise nice tutorial. |
| Name |
|---|


