| # | User | Rating |
|---|---|---|
| 1 | jiangly | 3810 |
| 2 | Benq | 3676 |
| 3 | Kevin114514 | 3655 |
| 4 | maroonrk | 3463 |
| 5 | strapple | 3447 |
| 6 | Um_nik | 3387 |
| 7 | heuristica | 3322 |
| 8 | turmax | 3317 |
| 9 | tourist | 3307 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 156 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | Um_nik | 143 |
| 5 | Errichto | 139 |
| 6 | adamant | 137 |
| 7 | AmShZ | 135 |
| 8 | maroonrk | 133 |
| 9 | BledDest | 132 |
| 10 | qwexd | 129 |
|
On
MikeMirzayanov →
2023-2024 ICPC, NERC, Northern Eurasia Onsite (Unrated, Online Mirror, ICPC Rules, Teams Preferred), 3 years ago
+38
If the problem is to solve $$$a_1 x_1 + a_2 x_2 + ... = b$$$ then you just iterate over parity of $$$x_1, x_2, ...$$$ and then reduce the problem to one where each $$$a_i$$$ is doubled. |
|
+38
So now that you've solved every problem(and can access every problem's discussion page), can you tell us if the "one-minute rule" is real? |
|
0
|
|
0
Do you know how to find ref. [5] (罗煜翔。(2020)。浅谈 Nimber 和多项式算法。IOI2020 中国国家集训队论⽂集。) ? I wanna see how to do semi-relaxed multiplication in $$$ \frac{n\log ^2 n}{\log \log n} $$$(if that's what it says). And what nimbers have to do with it xd. |
|
0
Do you have this report as a PDF? |
|
+10
|
|
+18
|
|
0
I also couldn't get it for a long time. The problem I had was that you can do inclusion-exclusion over sets where you do put the $$$ \lt $$$ signs into and then the solution is pretty much the same except at the end you need to sum over all possible "merges" of a sequence(like for [2,3,1] you sum over [2,3,1], [5,1], [2,4], [6]) which looks unsolvable. Had to read the beginning carefully again to understand it. |
|
+18
C in O(n log n) by hos.lyric The quadratic part of the official solution is as follows: create two vectors of numbers $$$P=(2^{N-1}-1, 2^{N-2}-1, \ldots, 2^{N-A}-1)$$$ and $$$Q=(2^{N-1}-1, \ldots, 2^{N-B}-1)$$$. Then repeat this step $$$B$$$ times: remove the last number $$$x$$$ from $$$Q$$$, subtract $$$x$$$ from every number in $$$Q$$$, add $$$x$$$ to every number in $$$P$$$, add $$$x$$$ to $$$P$$$. Find the product of all the numbers in $$$P$$$ and $$$Q$$$. Let's look at the numbers that are still currently in $$$Q$$$, those that were moved from $$$Q$$$ to $$$P$$$ and those in $$$P$$$ separately. The first group is pretty simple: it's a prefix of sequence $$$S = 1, 3, 7, \ldots, 2^k-1, \ldots$$$ times some power of 2. The pattern for the second group is a bit more tricky: the first number is a number from $$$S$$$. The rest of them is a "dot product" of a prefix of $$$S$$$ and some consecutive powers of 2. All in all it's a bit tedious but we can find the products of these numbers in linear time. The third group... has a pretty simple formula: after $$$i$$$-th step the product we need is $$$\prod_{j=1}^A{(2^{N-j}+2^{N-B+i}-2)}$$$. So the idea is just to come up with a polynomial and then evaluate it at $$$N$$$ points, which would usually take $$$O(N \log^2 N)$$$ time(both for constructing it as a product of $$$N$$$ monomials and multipoint evaluation), but can be done in $$$O(N \log N)$$$ here! Let's start with the polynomial $$$(x+1)(x+2)\ldots(x+2^k)$$$. Surprisingly(to me) its coefficients can be found in linear time thanks to something called q-binomial theorem(just reverse the coefficients). Then it's easy to find $$$(x+2^s)(x+2^{s+1})\ldots(x+2^{s+k})$$$ by multiplying each term by some power of 2. We can also change the variable from $$$x$$$ to $$$2^{N-B} x - 2$$$ again by similar manipulations and Taylor shift in $$$O(n \log n)$$$. This gives us the polynomial we need. All that's left is to evaluate it at $$$x=1,2,4,\ldots,2^B$$$ which can be done in $$$O(N \log N)$$$ with Chirp Z-transform. |
|
0
I still can't download A's full input(status code 500). If it's just me, could anyone help me out and upload it somewhere? Every other problem's fine. Also no K=1 tests in D1 -- kinda evil. |
|
+54
This is so bizarre. What's the smallest $$$\varepsilon$$$ such that an $$$O(n^\varepsilon)$$$ algorithm deserves a CVE? More or less than 1.5? |
|
0
Do you know how to prove this? It does make sense intuitively. |
|
+52
The real question is why would you keep your email public? |
|
+23
I don't understand how primitive types works in Kotlin. They say
Well, first of all, I don't understand what that means. Let's assume it means something like "Int, Double etc. are equivalent to primitive java types". But then why do we need IntArray and the like?(and yes, I know the answer is that IntArray is int[] and Now let's look at If it's the former then all of this is kinda useless for CP. If it's the latter, it's very cool of course but kind of... opaque? Is this the case for every method of Int(Double)? All in all, many questions, almost no answers(or I can't be bothered to try and find them). |
|
+26
No analysis for BOXES? I'll post my linear solution in the meantime. After thinking and wolframing for a bit, the task boils down to computing $$$_2F_1(-k,k-n;1;\frac43) = F(-k, k - n)$$$ for all $$$k$$$ from $$$1$$$ to $$$n$$$. After googling and reading about this for a bit, we find out about so called "contiguous relations" for hypergeometric functions that let us find in $$$O(1)$$$ the value of $$$F$$$ at one of the "neighbors"(in the 2D-space of $$$(a,b)$$$ pairs) of $$$(a,b)$$$ given $$$F(a,b)$$$ and the value of $$$F$$$ at another of its neighbors. So we naively compute $$$F(-1,1-n)$$$ and $$$F(-2,1-n)$$$ and then kind of "walk down" this staircase. You only need formulae 15.2.14 and 15.2.19 from here. |
|
+18
I mean, sure, the basic notions of various algebraic structures and properties is certainly helpful in that context but my perception of the OP question was that they were interested in some actual group theory concepts or results(like Burnside's lemma) applicable in CP. And since I've already started writing this comment, two examples come to my mind: |
|
+3
wut |
|
+3
A very minor nitpick: the algorithm from "Subset Sum Speedup 2" section actually finds the largest sum not exceeding $$$C$$$, doesn't just check if a set with sum $$$C$$$ exists. And here is a more substantial nitpick: towards the end of "(max,+) convolution" when you start describing how to build a totally monotone matrix to feed it to SMAWK, the linked paper simply says "...Consider the matrix $$$A$$$ with $$$A_{ij} = a_j +b_{i−j}$$$, where we suppose that elements of the sequences with out-of-bounds indices have value $$$- \infty$$$." (they need row maxima, hence the negative infinity). |
|
+47
How do you become a tester as an unrated user? |
|
+13
The idea of using two different functions that are only equal at prime arguments is brilliant! Also there is a simpler description of step 2 that shows how to solve this problem for any number instead of just 4. |
|
+3
Apparently this algorithm is attributed to Gauss. You can make it guaranteed $$$O(\log n)$$$ by noticing that $$$p = nq + r = n(q+1) - (n-r)$$$ and $$$\min(r, n - r) \le \frac n2$$$. But no one usually analyses your simpler one-liner version. |
|
+13
Thanks, this is pretty neat. It's also pretty interesting how your You can also do this with the usual down-propagation: just store two "push" variables in each node — one for propagating down the splay tree and another for propagating to your "light" children. |
|
+46
Who is this Min25 guy anyway? They're like a modern Prometheus, bringing the most arcane NT-algorithms into our measly CP realm. Yet I've never heard anything about them except their nickname. |
|
+8
This code is pretty weird tbh.
|
|
+15
|
|
0
First of all, orz orz orz. But I don't think the solution you linked uses mcfx optimization. AFAICT, mcfx optimization counts the number of times a node has been pushed into the queue, and if it's in $$$[2; \sqrt V ]$$$ then it push_front's otherwise it push_back's. It speeds up your solution from 1637 ms to 343 ms! |
|
+42
|
|
+16
How does this work if you edit your post/comment? |
|
+5
There're several on Project Euler. |
|
0
I just meant the numbers can get $$$n$$$ times larger. |
|
+24
To add to all that's been said, this is (almost) as difficult as max-plus convolution since you can do |
|
+42
A https://acm.timus.ru/problem.aspx?space=1&num=1481 Exactly the same problem, even the input/output format. |
|
0
You need somehow to only count each arrangement only once. This isn't straightforward to do in the "cycle" case because multiplying the polynomials only accounts for the sequence of chains lengths. So in addition to that we also say that each sequence starts where the "chain" containing "$$$b_0 \le b_1$$$ starts. And if the first "chain" has length $$$k$$$ then there're $$$k$$$ position(i.e. "$$$\le$$$" inequalities that we always keep) where it can be started, because the $$$b_0 \le b_1$$$ inequality can be at the any of $$$k$$$ positions in that chain and that position uniquely corresponds to a starting position. Example: say $$$n=10$$$ and the chains lengths are $$$( 3, 2 )$$$. This corresponds to 3 arrangements: $$$b_8 \le b_9 \lt b_0 \le b_1 \lt b_2 \le b_3 \wedge b_4 \le b_5 \lt b_6 \le b_7$$$ $$$b_6 \le b_7 \lt b_8 \le b_9 \lt b_0 \le b_1 \wedge b_2 \le b_3 \lt b_4 \le b_5$$$ |
|
+38
1) If n is even. Now, we apply inclusion-exclusion principle for all "$$$\ge$$$". Let's break the cycle(ignore the $$$b_{n-1} \ge b_0$$$ condition) first to make it easier. For example we might get something like $$$b_0 \le b_1 \wedge b_2 \le b_3 \lt b_4 \le b_5$$$ -- several independent chains of $$$\le$$$ and $$$ \lt $$$ alternating. How many solutions are there to $$$b_0 \le b_1 \lt b_2 \le b_3 \lt \dots \lt b_{2k-2} \le b_{2k-1}$$$? It's pretty simple to find out it's $$$f_k={{m+k}\choose {2k}}$$$. If we consider a polynomial $$$P(x)=-f_1 x - f_2 x^2 - f_3 x^3 - \dots$$$ and calculate $$$1 + P + P^2 + P^3 + \ldots = \frac{1}{1-P}$$$, then its $$$x^n$$$ coefficent gives us exactly the number we needed(multiplied by $$$(-1)^n$$$). How to deal with the cycle? First of all, we can't use all $$$n$$$ "$$$ \gt $$$" signs since it would mean $$$b_0 \gt b_0$$$. Before, we always had the first "chain" that started with $$$b_0 \le b_1$$$. Now let's say the first "chain" is the one that contains the $$$b_0 \le b_1$$$ condition. It's easy to see that if this first "chain" has length $$$k$$$(e.g. $$$k$$$ "$$$\le$$$" signs), then there are $$$k$$$ positions where it could've started and other than that it's exactly the same as in the "no-cycle" case. 2) If n is odd. Let's say a number $$$x$$$ is big if $$$x \ge \lceil \frac{m}{2} \rceil$$$ and small otherwise. As I've said above, since two large numbers can't be next to each other, you can split your cycle into segments which look like "small-large-small-large-small". So we only need to a) find out how many possible segments there are for each possible segment length and b) how to use that information to solve the problem. b) is very similar to the solution of part 1), except you don't need to use the PIE. To solve a), first subtract $$$\lceil \frac{m}{2} \rceil$$$ from every large number. If $$$m$$$ is even, you just got the "no-cycle" case of part 1), however the length of your sequence is now odd instead of even. Finally, how to deal with the fact that the sequence length is now odd? Similarly to solving the "circle" problem of part 1), we must consider the first chain separately. There are $$${m + k - 1} \choose {2k-1}$$$ solutions to $$$b_0 \gt b_1 \ge b_2 \gt \dots \gt b_{2 k - 3} \ge b_{2 k - 2}$$$ so you just define a polynomial $$$R$$$ that has these coefficients and the answer is $$$\frac{R}{1-P}$$$(here we'll need all of its terms, not just a single one). |
|
0
orz To make it a bit clearer for anyone else: the part about odd $$$n$$$ means that we can split our circle into segments of form $$$xy \dots yx$$$. |
|
+8
The (non-rigorous) conclusion I came to answer my question(why does/could it work for every function) was: essentially all the functions we usually use in these kind of problems can be given by their Taylor series. So stuff like exp, ln, square root, etc. is just a linear combination of the polynomial powers, hence if we can do multiplication we can do anything. Not very convincing, I know, but it was good enough for me. |
|
0
This expression is expanded into |
|
+8
Right, I was missing the idea of replacing zeroes with non-zeroes. |
|
+8
In "E. So Many Possibilities...", how to find "dp(l, S)" in $$$O(2^n n m)$$$ ? |
|
+15
This is a really nice way to look at it and makes the complexity analysis much more intuitive IMO. |
|
+11
What is "soooooooooo cool" about it? The fact the Time Limit is set to 1500 ms and not 1000 ms? |
|
0
This is so fucking cool, wow. Do you know any other problems(on some online judge) that can be solved using this stuff? Especially if they require finding exp or square root of "set power series"? UPD: After reading your solution and Lu Kaifeng's report it seems that the ranked Möbius transform is much more powerful than "Fourier meets Möbius" suggests: looks like you can apply any function to the set power series by applying it to a "ranked" vector for each mask independently. At the very least it works for subset convolution and logarithm so it would be very surprising if this doesn't hold in general. But what is this witchcraft??? Why does it work? |
|
+8
Isn't it just (almost)850F - Rainbow Balls? |
|
+18
(1, 0) == (-1, 0) according to your comparator. But I'm actually interested if there's an elegant way to do this as well. |
|
+38
|
|
+18
The actual submission https://contest.felk.cvut.cz/19cerc/submits/2014. |
|
+18
I think the formula is described in the paragraph starting with "Each site has its own...". |
|
+9
64553387 |
|
I thought the last sentence only applied to the example tests. Not sure if that was your intention :) But thanks for the answer anyway. |
|
But nothing was said about about how vertices in interactor's responses are chosen(well, except for the samples). |
|
So what was the jury interactor's strategy for C?(I hope it's not a secret) |
|
0
Have you implemented this? I tried doing exactly that(I think) but only got zeroes for the max test. |
|
+53
Editorial solution for div1 hard works in 2.844s and the time limit is 3 seconds, that's not cool. |
|
+29
|
|
0
What is this book? |
|
+24
It did happen to me once but not on CF(I think it was on Yandex.Contest) |
|
+11
peltorator, take notes |
|
+391
Are they ever expected? |
|
+12
Why did you switch to cpp for the last problem btw? |
|
0
Is it really necessary to have 130+ tests for A? |
|
+56
Sick advertisement :D |
|
+3
I don't see algorithm about Hamiltonian cycle on wikipedia. |
|
+10
I found rng58's analysis, even muted, pretty easy to understand: https://youtu.be/WFg2yJGZ2Cw?t=47m41s |
|
0
More like this weekend. |
|
+10
When can we expect solutions to GHJ? |
|
+5
In E do you even build suffix trees for every si and ti(or just one big suffix tree)? And if you do, how to get position in small tree from position in big tree? |
|
+10
Well, (u, u) and (v, v) use values from D and the other two use values from F so I don't think they cancel each other out or something. |
|
+10
When we use zero E tags the answer is sum over all matchings of given tree(because we can still use v->u and u->v edges). I don't understand the last part but it probably gets more complicated too. |
|
+20
Why is given graph a tree then? |
|
+8
The usual way to find the number of equivalence classes under a group of actions — Burnside's lemma. |
|
+1
Try here, Java works much better on CF. |
|
+11
And what about point distribution? |
|
+25
Or just group them by (x+y)%8. |
|
+31
If you can't give us rating, at least give us practice rooms ;_; |
|
0
But how do you handle sum from l to r(and C-type customers)? |
|
+60
I really like today's problems, is TC back? |
|
On
duckladydinh →
Help! Divide and Conquer Algorithm for Computing General Linear Recurrence???, 9 years ago
+5
It can be done in |
|
On
komendart →
Editorial Codeforces Round 445 (and Technocup 2018 — Elimination Round 3), 9 years ago
0
Could you elaborate on that? I don't really understand what it means. |
|
+8
Lol, I got AC for problem E with O(2n / 2) bruteforce(with some pruning of course) |
|
+15
|
|
+23
Were you the writer? |
|
0
I think in problem F it's clearer to let t(r) = E(number of steps taken if we reach S at the end, otherwise 0), then everything that follows makes perfect sense. If we make it conditional on reaching S first, then probabilties of moving to r-1 and r+1 aren't equal and overall it's a bit messier(but still doable). |
|
+34
Because div2A(which is like a+b) has 110+ tests and was solved by ~3500 people. |
|
0
Is there a combinatorial interpretation of formulas for problem E?(I mean formulas in the first part of editorial) |
|
+4
But there is a linear solution to this problem. |
|
+28
C was much harder than D and E IMO. |
|
+91
(1 + 2)n |
|
+96
This round had not 1 or 2, but 4(FOUR) testers. And none of them implemented bruteforce solution for A? I've always thought this is exactly testers' purpose. |
|
+11
160+ tests in problem A X_X |
|
+53
LOL |
|
+11
You were also the writer for the last 2 contests(w/o this SRM) I participated in :O |
|
0
For "Avoiding Adjacent", what is the complexity of dynamic programming solution? And was it supposed to get AC? |
|
+39
How is "unused code rule" enforced? Had to scroll through 3-4 screens of templates today before reading one solution(and there were some comments inside too). pinging cgy4ever |
|
0
Cool! |
|
+3
How to solve "Ample Syrup" in linear time? |
|
0
|
|
+5
It makes sense that summing many doubles is less precise than multiplying long by double. Why does it only matter in java is less clear to me. |
|
+8
In practice, one dfs is enough for n, m = 105. |
|
+62
Given a connected undirected graph, find number of pairs of edges such that graph becomes disconnected when these two edges are deleted. |
|
+10
First, consider table dp[i][j] — minimum cost to transform first i symbols of pattern into first j symbols of text. We have dp[0][j] = 0(because substring can start at any position) and usual transitions. Now for each difference j - i(say j - i = d) and each value s(0 ≤ s ≤ k) let's find the maximum i such that dp[i][i + d] = s, call it f[s][d]. If one of these maximums is equal to |P|, then we found a required substring. f[0][d] is just equal to lcp of P and T[d..] To calculate f[i][d] it's enough to consider f[i - 1][d + { - 1, 0, 1}], skip one symbol in P, T or them both, move forward by corresponding lcp and choose maximum of three values. |
| Name |
|---|


