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

顶你。

Posted by zjut020 at 2009-04-04 23:09:52 on Problem 2104
In Reply To:7s=1年. Posted by:liuyuquan100 at 2009-01-03 14:48:55
> 近1年了,终得近7s的时间AC了,无限感慨呀.以前总是从课本上得思路,利用快排,线性选择时间,总不得过.后得教训,不能只得出一个算法就行了,更重要的是时间复杂度.在ACM体现的更具体.最近,认真想了一下,才得过了.思路:用数据结构思想,给每个数编号,然后再对他们排序.对于每个(i,j,k);只要一次循环就行了.for(p=0;p<n;p++) if(a[p].num<=j&&a[p].num>=i) k--;当k=0时就可退出,此时a[p].data就是所求.
> 哎,人还真得活学活用.

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