| ||||||||||
| 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(nlogn)复杂度63ms 1A,贴过程int a[MAX];
int main(){
int L,x;
while(~scanf("%d",&L)){
int top=0;
a[0]=0;
for(int i=0;i<L;i++){
scanf("%d",&x);
if(x>a[top]) a[++top]=x;
else{
int low=0,high=top;
while(low<=high){
int mid=(low+high)/2;
if(a[mid]>=x) high=mid-1;
else low=mid+1;
}
a[low]=x;
}
}
printf("%d\n",top);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator