AtCoder Grand Contest 014 will be held on Saturday (time). The writer is yutaka1999.
The point values are 300 — 500 — 700 — 900 — 1400 — 2400. Note that the contest duration is unusual (130 minutes).
Let's discuss problems after the contest.
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
AtCoder Grand Contest 014 will be held on Saturday (time). The writer is yutaka1999.
The point values are 300 — 500 — 700 — 900 — 1400 — 2400. Note that the contest duration is unusual (130 minutes).
Let's discuss problems after the contest.
Name |
---|
When I click on editorial I get 404. Is it supposed to be like that right after contest and we should wait a while or is this simply a bug?
I had some trouble uploading it, now it is uploaded.
Problem E: An easy solution but heavy-coding :).
Find an edge with only one path (c[i], d[i]) pass through (if not answer is NO), remove it and do again.
I know this solution but idk how to do it fast.
I tried to do it fast, but got wrong answer.(I don't know if I implemented it wrongly or thought it wrongly.) Here is my way: we can use heavy-light decomposition, and for each edge in the tree, we record the number of paths that go through it on the vertex which has a larger depth. We also maintained two sets recording which paths are left by storing the dfs-number. When we find an edge with only one path passes through, we can find the path in the sets, and erase it.(Till now, I still couldn't find where is wrong in my programme.)
I implemented this solution.
Do heavy light decomposition and use segment tree. Let f(e) denote the number of red paths which pass through edge e. For every segment tree node we store a set of all red paths which pass through all the edges the node represents, and also the minimum f(e) among those. Also, we need some propagation to be able to update those minimums.
Now repeat this process n-1 times:
Find the edge e with minimum f(e). If this value is different than one, the answer is NO. Otherwise, remove the only unused red path which contains it from the segment tree, and set f(e) = infinity to avoid it ever being the minimal edge again. The complexity is O(n * log3(n))
Here is what I did in problem D.
The point being, in AtCoder contests you know the number of test cases that your solution fails at. While I do not claim that this is necessarily a bad thing, it offers some possibilities:
Assume you have a slow solution that is either correct but difficult in implementation, or you just believe that it is correct but do not have a proof. Assume also that you know how to speed it up, but it's difficult and requires data structures (or, say, integer FFT). Try submitting your slow solution! The only verdicts you should get are AC and TLE. If it happens to be so, you may now speed it up. This idea also may work in ACM ICPC style contests (unless the authors put large tests before the tricky ones) and in testing solutions of large inputs in GCJ.
If you know that your solution's speed is suboptimal but you time out only once or twice, try non-asymptotic optimizations first.
If your floating-point geometry problem fails only a couple of tests, try tweaking the epsilon. Note that this strategy is usually a bad one if the number of tests is unknown.
If you have several greedy ideas, try combining them and see how many tests you pass.
UPD. Here is an example of how to use this to your advantage: http://mirror.codeforces.com/blog/entry/50457#comment-346020
You're very close to the solution. What I did was store a priority queue of leaves sorted in decreasing order of height, and store the degree of each vertex. When we process a leaf, if it is the root, the graph has no edges and P1 wins. If the parent has degree > 2, P1 wins. If the parent is not the root and it has degree 2, then we delete the leaf and its parent and update the degree of parent of parent of leaf accordingly. If the parent of parent becomes a leaf, push it into the priority queue. Finally, if the parent of the leaf is the root, then P2 wins iff the root has exactly one child.