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 |
Re:哪位高手麻烦帮忙看看^_^,怎么会超时呢?谢谢哦~In Reply To:哪位高手麻烦帮忙看看^_^,怎么会超时呢?谢谢哦~ Posted by:acm_pku at 2007-07-23 09:47:20 想到一个可以改进的地方,举个例子说明一下,比如i=4的时候,内循环比较,假如4后面有连续3个元素小于a[4],这时候b[4]=3,显然有a[8]>a[4].所以对于a[7],不用比较直接就知道结果b[7]=0,a[5],a[6]也能很快获悉。 也就是说,每一趟循环,都会有一些有用的信息,利用这些信息,看能不能把二层循环优化为一层?山人浅识~~~ Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator