Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

有一种更容易理解的方法

Posted by yygy at 2012-11-14 19:28:39 on Problem 3212
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator