Let's discuss problems here.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Let's discuss problems here.
Название |
---|
Is there an official editorial? If not, then how to solve J?
Editorial
How to solve problem D? MO algorithms gives TLE. I have an idea with Merge Sort Tree(as segment tree,but we store elements) . Will it pass ?
We solved D with Mo's Algorithm in under 2s. The idea is to have purely $$$O(Q \sqrt N)$$$ complexity (no log factor). You can do that with linked lists and undo (change inserions to erase and adapt Mo's Algo accordingly).
Thank you bicsi !
better coded than ours :). An observation: the final complexity is $$$O(n \sqrt q)$$$.
We used Mo algorithm with linked list over sorted segment. Deletion from linked list is $$$\mathcal{O}(1)$$$ and you use rollbacks to insert elements. To make this work with Mo algorithm sort queries by $$$(r/B, l, r)$$$. Then for each block you have $$$l \in [0, r)$$$ and $$$r \in [B * block, (B+1)*block)$$$, so insert all items from range $$$[0, (B+1)*block)$$$ into linked list, then to handle each query in sorted order you:
Thank you ATSTNG ! Obviously, linked list is better than set.
How to solve problems G from Div1 and M from Div2 ? Our team thought may be random will work for M.
My Solution for Div.2 M: Let's shuffle the given permutation. The interactor is not adaptive, so we can assume that each location has an equal probability of containing a treasure, assuming it is $$$p$$$. Suppose we examine the first 20 locations in turn, then the probability that the first 20 positions do not contain any treasure is $$$(1-p)^{20}$$$. If this happens, then we can assume that $$$p$$$ is sufficiently small, so that among the remaining positions, we can assume that the probability of picking any two positions, both of which contain the treasure is small ($$$p^2$$$). Then, we perform about 20 more queries, choosing 2 adjacent positions for each queries. There is a $$$p^2$$$ probability of missing the answer. But since $$$p$$$ is small enough, $$$p^2$$$ is also small enough. If we still do not find an answer, then we consider the distribution of the treasure to be more sparse, and continue to increase the number of locations per query. The limit on the number of queries does not appear to be strict, and can be passed by taking a random reasonable set of strategies. Code
Thank you Qingyu ! Very interesting observation.
Is there any div.2 editorial available?
Problem A~K are the same as Div.1 problems
Div.2 L: The Euler characteristic shows that $$$V-E+F-C=1$$$ on any planar graph $$$G$$$. So we have $$$C=V-E$$$ and the answer is simply $$$\max(n-m,0)$$$
Div.2 M: here
Div.2 N: After convert each portkey to intervals, the problem is essentially the same as CF786B. There will be up to $$$5n+m$$$ endpoints of the interval, but only $$$n+m$$$ of them will be useful. Code
Div.2 O: The distance of the two points is just $$$d=|x_1-y_1|+|x_2-y_2|$$$, and note that the given graph is a bipartite graph, so the given condition is equivalent to $$$d \geq w$$$ and $$$d\equiv w \pmod 2$$$.
for N, it is possible to use BFS also.
For problem K, we had the following algorithm (which gave WA, but we apparently had a proof of):
Root the tree at any vertex which is not a leaf ($$$n = 2$$$ is handled manually), and order leaves in pre-order. Then we will try to pair up leaves such that all paths go through one common vertex (not necessarily that root). This can be done by, say, pairing up the leaves $$$0, \lfloor m/2 \rfloor$$$, $$$1, 1 + \lfloor m/2 \rfloor$$$ and so on, and pair the last leaf with the first leaf.
Our proof was based on the fact that the vertices that are in a path but not in the previous path form at most two chains, and if we root the tree at the common vertex of all such paths, then the chains are no longer candidates for the thief's position.
Could someone point out a counterexample to this algorithm if the proof sounds wrong?
The problem is that leaf $$$\lfloor m/2 \rfloor$$$ can be in the middle of a subtree. If you first scan half of the subtree, then later the other half, the bad guy could move between the two parts of the subtree.
Is there somewhere better explanation of problem I? It seems that a lot of important details skipped in the Editorial's explanation.
Assume that the drunkard is at position $$$x$$$, and let $$$\mathrm{dp}_{i,j}$$$ denote the probability of being at moment $$$i$$$ and passing through position $$$x+j$$$ at least once. Obviously $$$x$$$ does not affect the answer, so we only need to focus on the relative distance we are from the end point at each moment. We have $$$dp_{i,0}=1$$$, and $$$\mathrm{dp}_{i,j}=p \cdot \mathrm{dp}_{i+1,j}+(1-p) \cdot \mathrm{dp}_{i+1,j-a_{i+1}}$$$, so we can calculate all $$$\mathrm{dp}_{*,*}$$$ in $$$O(n^2)$$$.
It's easy to observe that if the relative distance(signed) between the end point and the start point is $$$x$$$, then the probability of passing through $$$x$$$ at least once is just $$$\mathrm{dp}_{0,x}$$$, and the answer is $$$\frac{1}{2n+1} \sum_{i} \mathrm{dp}_{0,i}$$$. Code
how to get an account?
You should probably ask one of closest sector's admin or register new sector. All information is here.
How to find one of closest sector's admin?
I don't know, maybe it would be a good solution to ask in site-register@opencup.org.
In problem G, it is not clear how to build the convex hull as for the set of points from example, it will be the monotonous ascending function. Is there any other explanations for problem G ? Endagorion Qingyu
My teammates just checked 50 points around)) I don't know why it works.
AmDer Can you send your solution ?
Wow, it's 32 in the last send!
Thank you AmDer !
Maybe someone from Div.1 will be able to explain this problem ?
When we iterate $$$c$$$ over $$$X$$$ in ascending order, the slope of some lines increases. All we need to do is add a new line to the corresponding position. This can be done by using Li Chao Tree or convex hull trick.
Know, everything is clear for me about convex hull trick. But how that function is corresponded to this trick ? Where is k,b,x ? Qingyu Endagorion
And what does this function fc(y) mean? As far I understand it doesn't count loose. Qingyu
I would be thankful, if someone, maybe from Div1 will help me to understand the solution.
Thank you Qingyu,mtw! It is clear now.
google convex hull trick
Can anyone share the code for Problem B? I don't understand the last part of the editorial