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 |
O(N)-O(sqrt(N))的方法 388K 1922MS将数组分成多段每段长度sqrt(N),预先求好每段的最大最小值,然后再进行O(sqrt(N))的查找 思路也比较直观 内存使用非常少 写起来和ST差不多 比线段树要简单很多 代码就不贴了 具体方法可参考下面的链接:http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=lowestCommonAncestor Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator