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

Re:线段树怎么写能不超时呢?

Posted by qinhanlei at 2008-09-02 16:35:11 on Problem 2528
In Reply To:线段树怎么写能不超时呢? Posted by:alpc16 at 2008-05-18 10:14:18
哇``  沙发...  
有机会回复大牛..  激动中...  
加个离散化.. 

偶也是看这里人讨论才去搜了离散化的..   

具体的思想, 是说只考虑我们所需要处理的点.. 
也就是说 20000 个有效点的坐标范围为(1~10000000), 映射成 数值范围为(0~20000) 的点,这样子就可以了.. 

所以建立线段树的时候最多只要长度20000足矣, 空间就减少了很多, 无效搜索就可以减少很多了.

讲得不清楚... 请原谅偶这个菜鸟...





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