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 | 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 |
# | User | Contrib. |
---|---|---|
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 |
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
Unable to parse markup [type=CF_TEX]
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 minimumUnable to parse markup [type=CF_TEX]
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
Unable to parse markup [type=CF_TEX]
. 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 setUnable to parse markup [type=CF_TEX]
to avoid it ever being the minimal edge again. The complexity isUnable to parse markup [type=CF_TEX]
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.