# | 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 | 166 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 160 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
In today's Div.2E, I thought of a possible correct approach, but I can only feel that its number of operations is relatively good, and I can't calculate or give a hack.
My idea is that on a tree, we perform heavy chain decomposition on it. We found that the kangaroo needs to go through at most $$$log_n$$$ light edges to reach the root. For each heavy chain (a total of $$$log_n$$$), we perform binary division on it to the node of the next heavy chain. Then for this node (we assume it is $$$k$$$), for all its child nodes, we traverse from large to small according to the size of their subtrees, and this step only requires $$$O(\sqrt{siz_k})$$$.
I didn't elaborate on some of the small details, mainly because we need to prevent the kangaroo from running out of the subtree when we divide or query the child nodes, so we may query several times more (causing twice the constant).
Can anyone help me? Thank you very much.
Please note that the return value of the ceil function is not an integer, but a float / double / long double.
When you use cout output, your ceil may return a value of 8.49371e+06 instead of 8493712.
If you want to use its return value for output, you need to convert it to an integer first.
Yesterday, I encountered this problem while working on problem B of Codeforces Round 926 (Div. 2), and I took a penalty and searched for the error for a long time (246502057 and 246508172).
It's really bad.
I hope what I said is helpful to you, XD.
Name |
---|