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 wangfangbob at 2007-10-30 14:42:56
In Reply To:见内 Posted by:ACM06060 at 2007-10-30 14:39:14
线段树内每个节点4个关键域: 最大和线段的左右端点位置,以线段左端点为左端点的最大和线段的右端点位置,以线段右端点为右端点的最大和线段的左端点位置,然后就可以递推了

> 分成logn层,每个都是长的为2^k长度。
> 那么我们每次要查询的段都是logn段
> 那么
> 答案要么在这logn段的某个段内,要么是横跨好几个段的
> 对于第一个问题我们在预处理的时候用nlogn可以做出来
> 第二个问题就相当于是在logn个数中查找最大子段和~这个是o(m)的,m=logn
> 那么每次查询就是O(logn)那么总复杂度就是NlogN
> 
> 线段树会退化吧?感觉是,不太清楚。你说说你具体咋想的

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