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 derness at 2007-07-23 11:23:42 on Problem 3250
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:
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