| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
有一种更容易理解的方法In Reply To:处理曼哈顿距离时的扫描 Posted by:yc5_yc at 2012-07-31 14:11:25 第i个点到其他点的MHD距离之和是
sum{abs(p[i].x-p[k].x)+abs(p[i].y-p[k].y)}
=sum{abs(p[i].x-p[k].x)}+sum{abs(p[i].y-p[k].y)}
所以可以独立求解。
然后就是排个序,正向,逆向扫瞄一下就行了。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator