### rng_58's blog

By rng_58, history, 5 years ago,

How to enter the contest?

• +39

| Write comment?
 » 5 years ago, # |   +8
 » 5 years ago, # |   +71 Judge is not working now :(
•  » » 5 years ago, # ^ |   +41 Our code has been running for 30 minutes. Are there any teams that are having the same problem?
•  » » » 5 years ago, # ^ |   +26 We have the same issue.
 » 5 years ago, # | ← Rev. 2 →   +95 Is this some kind of Div2 OpenCup?
•  » » 5 years ago, # ^ |   0
 » 5 years ago, # |   -8 How to solve C and D?
•  » » 5 years ago, # ^ |   0 In C we asked vertices for which we haven't got -1 and with maximal probability to reach edge to another component. This could be estimised by deg(v) — size_connected_component(v)
•  » » » 5 years ago, # ^ |   0 We took the vertex with the highest degree from the smallest component and that also worked well.
•  » » » » 5 years ago, # ^ |   +13 I took random vertex (which I haven't got -1) from the smallest component and that also worked well.
•  » » » » » 5 years ago, # ^ |   +9 We just picked any vertex (except -1) with the minimal degree
•  » » » » 5 years ago, # ^ |   +11 We took arbitrary vertex (ofc that we haven't got -1 already) from smallest component. I don't think degree of the vertex is useful in this case.
•  » » » » » 5 years ago, # ^ |   +8 We took the vertex with the lowest degree (don't care about its component) and got AC. Seems like the judges want to make people happy and let everyone pass :D
•  » » » » » » 5 years ago, # ^ |   +126
•  » » » 5 years ago, # ^ |   +34 I took a random permutation and asked 2 times for each vertex in the permutation, somehow that got AC.
•  » » » » 5 years ago, # ^ |   +16 Wait... But in random graph random permutation ~ $1, 2, \ldots, n$.So is it really working to ask(1), ask(2), ..., ask(n), ask(1), ask(2), ..., ask(n)? (>﹏<)
•  » » » » » 5 years ago, # ^ |   +16 Indeed, this problem works in mysterious ways rofl it didn't pass for 1 2 3 4 5 ... n
 » 5 years ago, # | ← Rev. 2 →   +10 Our submissions has not judged in last an hour (still running). Did someone else have the same problem?
•  » » 5 years ago, # ^ |   0 the same
 » 5 years ago, # |   +8 How to solve B?
•  » » 5 years ago, # ^ |   +24 Enumerate every field in table and xor indices of fields with ones
 » 5 years ago, # | ← Rev. 2 →   +21 No C++11 in a testing system. Judges are still in 2007 or what?! Submissions sent in 04:20 are still running No one answered on our clar submitted at 04:15, and didn't even read it Worst opencup organization ever
•  » » 5 years ago, # ^ |   +52 C++0x is basically C++11
 » 5 years ago, # | ← Rev. 3 →   0 How to solve A without Gauss elimination?
•  » » 5 years ago, # ^ |   +11 A could be solved by interpolation. But under this constraints it is not better than gauss
•  » » 5 years ago, # ^ |   +47 In A we can use the fact that for every $k\geq d+1$ the following holds: $\sum_{i=0}^k(-1)^i\binom{k}{i}P(a+bi)=0.$Then we choose random $a$ and $b$ and increase $k$ until we get equality modulo $mod$.
•  » » 5 years ago, # ^ |   +27 Fact: If $f(x)$ is a polynomial with degree $n$ then $f_{1}(x) = f(x + a) - f(x)$ (with any constant $a$) is a polynomial with degree $n-1$. If we define $f_{k}(x) = f_{k-1}(x + a) - f_{k-1}(x)$ then $f_{n}(x)$ will be a non-zero constant and $f_{n+1}(x) = 0$. The converse is also true. Therefore you can ask integers of form $b+at$ with some random constants $a$, $b$ and compute values of $f_{k}(x)$ accordingly. As soon as we find out $f_{k}(b) = f_{k}(b+a) = 0$ we can determine with high probability that $f(x)$ is of degree $k+1$.
•  » » » 5 years ago, # ^ |   0 ^this
 » 5 years ago, # |   +32 How to solve D? We solved it O(N * sqrt(N) * log(N)), but we do not know the verdict yet.
•  » » 5 years ago, # ^ | ← Rev. 3 →   +27 Our solution is $O(N^{3/2})$.Just do sqrt decomposition. It`s easy to deal using some precalculation before the queries with a pair of sqrt blocks (sort each block), with an element and a block (just sort each block and calculate values in increasing order of elements using some pointers for each block), and, finally, after the query you solve for a pair of "pieces of blocks" (using the fact that you can store all sorted prefixes and suffixes of all blocks in $O(N^{3/2})$ time and memory).
•  » » 5 years ago, # ^ |   0 I got AC with your complexity, making the block size as low as possible and getting rid of the log in precalculation. The only part with log was sorting the "pieces of blocks" but that works quite fast since it uses little memory.
•  » » 5 years ago, # ^ |   +42 I solve D with Mo + Fenwick Tree + Hard Struggle
•  » » » 5 years ago, # ^ | ← Rev. 3 →   +26 I solved D with $O(n^{1.5}\log n)$ after TLE for 10+ times. And my $O(n^{1.5})$ solution got MLE :(
 » 5 years ago, # |   +16 Where is the baobab in the Math&Mech facility?
•  » » 5 years ago, # ^ | ← Rev. 2 →   +16 Top-left corner on this map (from here), medium square hall:Dot on this map:Here is a photo from this website:
 » 5 years ago, # |   +44 So what was the jury interactor's strategy for C?(I hope it's not a secret)
•  » » 5 years ago, # ^ |   -20 No strategy, no secret, described in the statement: the graph is random and fixed in each test case.
•  » » » 5 years ago, # ^ |   +68 But nothing was said about about how vertices in interactor's responses are chosen(well, except for the samples).
•  » » » » 5 years ago, # ^ |   -57 The edges of the graph are ordered (uniformly at random) in advance. Then, for each question about vertex $v$, the answer is the first edge incident to $v$ in that order, or $-1$ if there is no such edge left.This strategy is actually given in the Note section after the example:
•  » » » » » 5 years ago, # ^ | ← Rev. 3 →   +61 I thought that this Note is describing a strategy for the example, not for all tests. I don't think that Note is a proper place for jury strategy description :)
•  » » » » » 5 years ago, # ^ |   +48 I thought the last sentence only applied to the example tests. Not sure if that was your intention :) But thanks for the answer anyway.
•  » » » » » » 5 years ago, # ^ |   +1 Yeah, I see now how this can be misleading.Sorry for the confusion!
 » 5 years ago, # |   +26 Our C still in queue.
•  » » 5 years ago, # ^ |   +28 three hours after the contest, our D still in queue
 » 5 years ago, # |   +18 How to solve G?
•  » » 5 years ago, # ^ | ← Rev. 2 →   +16 You are given $N$ functions of the form $f_i(\theta) = |r_i sin(\theta + \alpha_i)|$, and you want to find $\theta$ that maximizes the sum of $K$ smallest values among $f_i(\theta)$.This sum is a "piecewise trigonometric function" with $O(N^2)$ pieces, so we can explicitly represent this function and compute the maximum.The border between two pieces is a point that satisfies $f_i(\theta) = 0$ or $f_i(\theta) = f_j(\theta)$ for some $i,j$. We should list all such angles and sort them, and do various things carefully.
 » 5 years ago, # |   +26 Will be editorial or upsolving?
 » 5 years ago, # |   +26 One of our submission is still pending: problem B in Java, at 0:52 during the contest. No response for clarifications. I believe the judge is broken.
•  » » 5 years ago, # ^ |   0 We received "Check failed" verdict for problem B solution on Java during the contest. Switched to C++ to get it judged.
 » 5 years ago, # |   +16 How to solve F?
•  » » 5 years ago, # ^ |   +21 Greedy. Let's store the answer for each vertex $v$ — the indices of taken decorations in its subtree. The answer for some vertex $v$ is the union of answers for all its children plus $w_v$ values of $v$. Truncate that list to $min(t, w_v)$ most expensive values, that'll be the answer. Use small-to-large and store the answer in a map to achieve $O(n \log^2 n)$.