| № | Пользователь | Рейтинг |
|---|---|---|
| 1 | Kevin114514 | 3722 |
| 2 | Benq | 3676 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3408 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3196 |
| 10 | idontwannadothis…e | 3191 |
| Страны | Города | Организации | Всё → |
| № | Пользователь | Вклад |
|---|---|---|
| 1 | maroonrk | 153 |
| 2 | Qingyu | 152 |
| 3 | nik_exists | 151 |
| 4 | AmShZ | 147 |
| 4 | maspy | 147 |
| 6 | Um_nik | 142 |
| 7 | Errichto | 139 |
| 8 | adamant | 136 |
| 9 | BledDest | 135 |
| 10 | AksLolCoding | 132 |
|
+16
I also used GCC 7 (32-bit) on the contest yesterday, but my submission passed without any issues: 297315717. Arguably, my code is even worse because I am creating and returning a new After a bit of experimenting, here is what I can share:
The takeaway? I honestly don't know. But I will definitely stick to GCC 14 (64 bit) from now on. |
|
+4
I solved it in a different way than described in the editorial. First of all, notice that for any rectangle with even lengths, odd sum and even sum are completely symmetric. Thus, for some $$$2n \times 2m$$$ matrix we can take the answer as just $$$sum / 2$$$. Then, if either width or height of a rectangle is odd, you could separately add one row and one column to the answer. If both of them are odd, don't forget to subtract the contribution of one cell in the border because we count it twice. |
|
+9
Wait, the statement says you have to do $$$(+\ 1)$$$ and $$$(\times\ 2)$$$ both simultaneously in one operation. Moreover, it is not allowed to have $$$i = j$$$. Or am I missing something? |
|
+14
|
|
+4
I have a solution to problem E which does not involve graphs in any way. At the beginning, our array values fit in range $$$[0, 2^{30}]$$$. Let's now divide the array into two parts $$$L$$$ and $$$R$$$, where $$$L$$$ will contain all values $$$\le 2^{29}$$$ and $$$R$$$ will contain all larger values. Now suppose $$$(x, y)$$$ is the optimal pair we are searching for. Here comes a crucial observation. If both $$$(x, y)$$$ are in $$$R$$$ they are both larger than $$$2^{29}$$$ so we cannot use any $$$k \le 29$$$ operation on them. The only way to continue is to use $$$k = 30$$$ and make them both less than $$$2^{29}$$$. Also suppose $$$x \le 2^{29}$$$ and $$$y \gt 2^{29}$$$. In this case we have to transfer one value to the other side by using $$$k = 30$$$, but transferring $$$x$$$ is never optimal. Let's prove it. Case $$$x = 2^{29}$$$ is trivial. Otherwise $$$x \lt 2^{29}$$$ so $$$2^{30} - x \gt 2^{29}$$$ and since also $$$y \gt 2^{29}$$$ we arrive at the previous state when we are forced to decrease both of them using $$$k = 30$$$. This means that it is always better to do an operation on $$$y$$$, again reducing it to some value $$$ \lt 2^{29}$$$ and continue from there. All the reasoning above means that all values $$$R$$$ have to be reduced in one operation to become less than $$$2^{29}$$$ and after that we can merge those values with $$$L$$$ and repeat our algorithm again with a threshold $$$2^{29}$$$. We can repeat this process until we arrive at a simple case when all values are in range $$$[0, 1]$$$. Here we can just consider a transition $$$0 \rightarrow 1$$$ and we are done. This solution can be implemented in various ways. One I can think of is to store $$$L$$$ and $$$R$$$ as sorted vectors and merge them using two pointers. But I personally think that maps are the most simple and elegant way. Maps introduce an additional $$$\log n$$$ factor, resulting in a $$$O(n \log n \log 10^9)$$$ solution overall which is still fast enough considering a very generous time limit. Here is my submission: https://codeforces.me/contest/1617/submission/139683868 |
|
На
Libraion →
[Help] Split array into maximum number of segments such that their sums is non-decreasing, 5 лет назад
+3
I think this task is almost the same. My spoilers are for the linked problem. Spoiler 1 You can come up with $$$DP[i][j]$$$ — the least possible sum of last segment, if the last segment is $$$j$$$ and it ends at a position $$$i$$$. Spoiler 2 We can completely get rid of $$$j$$$ dimension, and store $$$DP[i]$$$ as a pair $$$(mx, sum)$$$. $$$mx$$$ is the maximum number of segments we can divide the prefix $$$(a_1, \ldots, a_i)$$$ into, and $$$sum$$$ is the least possible sum of last segment. |
|
+25
I would probably do it this way: code But note that it doesn't work when $$$n = 1$$$ or $$$m = 1$$$ so you will probably have to run a simple loop for that. |
|
0
Same. Tool and Opeth are my favourites. |
|
+3
The reason your Your code gets AC without |
|
На
Harbour.Space →
Harbour.Space Scholarship Contest 2021-2022 (Div. 1 + Div. 2) Editorial, 5 лет назад
+15
Suppose you have a connected component of size $$$k$$$. It will surely be a cycle. You can easily show that this cycle can be fixed using $$$k-1$$$ swaps, but not less. In total this will sum up to $$$n - cycles$$$ operations. Also you could try mixing elements between different cycles, but you will see it does not help either. This is not a formal proof, just a simple explanation built on pure intuition and logic. |
|
На
Harbour.Space →
Harbour.Space Scholarship Contest 2021-2022 (Div. 1 + Div. 2) Editorial, 5 лет назад
+73
Hey, I am an author of problem F. We actually did not intend any $$$O(N \sqrt{M} \log M)$$$ solutions to pass at the beginning. The thing is, my Fenwick tree solution works in ~400 ms, but my segment tree solution works in ~2.5 s. Segment tree with pushes does not even pass the time limit because of a high constant factor. Also we had to care about Java solutions, so I decided to raise the TL from 3s to 4s, letting $$$O(N \sqrt{M} \log M)$$$ to pass. I know I had to fix this problem in a more adequate way by experimenting with constraints. Will certainly do that in future rounds. Sorry about that. |
|
+5
There is a small mistake in your explanation. Actually, you need to multiply A by B in power of f(P)-1 and f(P) for prime number is P-1. |
|
+3
Okay, I will try to explain. You need to understand that if there is a vertex A and a vertex B, and A is parent of B, you ALWAYS need to paint A first. Why? Because if we paint B, then A, the color of B becomes the same as the color of A (don't forget that A is parent B). So you will need to paint it again, which is not optimal. That's why we need to start painting from the root of tree. |
|
На
MikeMirzayanov →
2017-2018 ACM-ICPC, NEERC, Southern Subregional Contest (Online Mirror, ACM-ICPC Rules, Teams Preferred), 9 лет назад
0
Опечатка: "многие из которых были получили приглашение". |
|
0
Maybe you're asking about simple segment tree. Try to google "minimum query segment tree" in google. |
| Название |
|---|


