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 yuanyirui at 2008-01-23 08:57:13 on Problem 2452
    for(i=start;i<=end;i++){
        if(stick[i]>ma) ma=stick[i] , mapo=i;
        else if(stick[i]<mi) mi=stick[i] , mipo=i;
    }
    if(mapo-mipo>bestlen){
        bestlen=mapo-mipo;
    }
    if(mipo-1-start>bestlen) findlen(start,mipo-1);
    if(end-mapo-1>bestlen) findlen(mapo+1,end);
这样的二分差20ms就没过,还能改进吗?

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