| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | jiangly | 3670 |
| 3 | Kevin114514 | 3657 |
| 4 | maroonrk | 3355 |
| 5 | Um_nik | 3353 |
| 6 | squareOf105 | 3346 |
| 7 | tourist | 3343 |
| 8 | strapple | 3324 |
| 9 | heuristica | 3322 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | AmShZ | 143 |
| 5 | Um_nik | 141 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 133 |
| 8 | maroonrk | 133 |
| 10 | qwexd | 130 |
|
+7
The number of possible states should actually be bounded by $$$2^{32}$$$ as the problem statement guarantees that the product of $$$X$$$s fit into a 32-bit integer. That said, I believe you should be able to partition the congruences into two disjoint sets (of roughly equal number of states, so upper bounded by $$$2^{18}$$$) and generate all possible solutions in each set and use some kind of meet in the middle technique. |
|
0
A general way to solve this (not just limited to 3 partitions), assuming the partitions are ordered: https://math.stackexchange.com/questions/98065/how-many-ways-can-b-balls-be-distributed-in-c-containers-with-no-more-than |
|
+8
I wouldn't consider 30 lines solution heavy implementation... and if you came up with a more implementation-ugly solution (which seems to be in your case) than the model solution, then that alone teaches you that you can come up with a more elegant solution, so what is the issue here? |
|
+9
Maybe what you are looking for is Markov Chains? |
|
+31
Oh my bad didn't read carefully. |
|
0
That is only true for a general graph. This graph has a special structure which allows an efficient solution. |
|
0
Bounding the total number of operations of the algorithm in the editorial requires mathematical analysis, even if you may call it elementary. |
|
0
You can literally put math tag for any problem, even if it doesn't require any advanced math. |
|
+3
This won't work. Consider a path graph of 5 vertices. If your algorithm somehow picks the middle vertex as the first to remove, it will produce 3 as the answer, but 2 is actually optimal. |
|
+5
Link? This looks like an NP-hard problem, unless there are some other constraints you haven't mentioned. The underlying graph structure is a superset of unit disk graphs, and I'm 99% sure minimum vertex cover on this graph remains NP-hard. |
|
+12
Yea, but for most easy problems usually the gap between intuition and formal proof is not this large. Most of the time all you need to do is to formalize your intuition to turn it into a complete proof, which is definitely not the case for this problem. |
|
+1
Just binary search on the diameter $$$d$$$, and for each adjacent elements $$$a_i$$$ and $$$a_{i + 1}$$$, count the number of elements $$$a_j$$$ left of $$$a_i$$$ with $$$2a_j \lt d$$$ and the number of elements $$$a_k$$$ right of $$$a_{i + 1}$$$ with $$$2a_k \lt d$$$. Then the total number of modifications needed is the count above + $$$(a_i \lt d)$$$ + $$$(a_{i + 1} \lt d)$$$. If this count $$$\leq K$$$, diameter $$$d$$$ is feasible. |
|
On
abhinavvv306 →
Invitation to CodeChef July Starters 49 (Rated for Div 2, 3 & 4) — 27th July, 4 years ago
0
Is Codechef traffic that much higher than Codeforces, or did they just not bother scaling up their servers? |
|
0
You can use the same reasoning as in solution 1, that there is an optimal solution where all the skipping happens before the tests that decrease the IQ. |
|
0
The process converges very quickly to all zeros because the number of distinct differences is $$$O(\sqrt{M})$$$ where $$$M$$$ is the largest element in the current iteration. |
|
+8
fun(n — 1, val — arr[n]) will be counted as part of fun(n, val — arr[n]) follwed by fun(n — 1, val — arr[n]), so you are going to be double counting. |
|
+25
Spoiler Start with a set of $$$N$$$ nodes, without any edges added. At this point, each node is a connected component by itself. Let $$$V'$$$ be the set of values ($$$V$$$ without duplicates). For each $$$v \in V'$$$ in ascending order, add edges with one endpoint with value $$$v$$$ and another endpoint with value $$$\leq v$$$. Maintain the connected components that are formed during this procedure using disjoint set data structure. After the edges are added, if in a component $$$C$$$ there are $$$k$$$ nodes with value $$$v$$$, add $$$k(k - 1) / 2$$$ to the answer — this counts the number of paths with two endpoints with value $$$v$$$ in $$$C$$$. In the end, we will have counted the number of distinct paths with two endpoints with equal values, with the values of the intermediate nodes not exceeding the value of the endpoints. What remains is to subtract the number of paths of length 1 with endpoints with equal values. But this is trivial — just subtract the number of corresponding edges. With careful implementation, the running time should be $$$O(N log N)$$$ because of sorting. |
|
0
Hint: disjoint set union. |
|
0
One can think of this problem as choosing the maximum length subsequence with equal elements, such that the interval between the chosen consecutive elements can be deleted completely. It's very similar to a classic LIS problem. |
|
+5
An interval can be completely deleted if it's even length and there is no strict majority element. Using this fact, just do $$$O(n^2)$$$ dp. |
| Name |
|---|


