Can someone explain IOI 2011 RACE solution using CD?
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
Can someone explain IOI 2011 RACE solution using CD?
Name |
---|
Like this problem: https://codeforces.net/problemset/problem/161/D but you save the shortest path with a path length i call it dp[i]. Assuming that you are considering centroid c, after going through a tree branch, you save the dp[i] as the shortest path of length i from c every time you move to a new branch, the result will update again as min(ans , dp[i]+dp[k-i]) with the condition dp[i]!=-1 && dp[k-i]!=-1. Because k is quite large, when you finish browsing 1 centroid, you will only update the dp you just reviewed. sorry my english is very bad My code for this problem: https://ideone.com/VOmd3A
so for every centroid c, you will have 2 DFS, one to compute the dp, another to update, right?
yeah!