Can somebody explain this solution http://www.codechef.com/viewsolution/2949645 for this problem http://www.codechef.com/problems/CPOINT/.
№ | Пользователь | Рейтинг |
---|---|---|
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 |
Can somebody explain this solution http://www.codechef.com/viewsolution/2949645 for this problem http://www.codechef.com/problems/CPOINT/.
Название |
---|
Newton's method in optimization http://en.wikipedia.org/wiki/Newton's_method_in_optimization http://en.wikipedia.org/wiki/Newton's_method_in_optimization
links does not work.
The same problem was in ch24 qualifying round some years ago. There is another nice way to solve it using hill climbing optimization. You can start from the point (Xs = avg{Xi}, Ys = avg{Yi}) and then try to move in each of the 8 directions by some distance d = 1010 and see which point has the best result out of eight and then you repeat the move but with a smaller distnace d = d / 10. Once d reaches some convergence threshold, 1e - 9 for example, you can output the solution.
I will give it a shot using 2D ternary search, though it is often hard to prove correctness in similar solutions... It is nice to see gradient and hessian applied in some algos :).
Yes, many have solved it using 2D ternary search. But ternary search took a lot of time compared to the gradient and hessian.