This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
pair<int,int>step[200005];
int a[200005],d[200005];
int main(){
int n,x;
cin>>n>>x;
d[0]=-2e9;
for(int i=1;i<=n;i++){
d[i]=2e9;
cin>>a[i];
int l=0,r=n+1;
while(l+1<r){
int mid=(l+r)/2;
if(d[mid]<a[i]) l=mid;
else r=mid;
}
l++;
if(d[l]>a[i]){
step[i]={l,d[l]};
d[l]=a[i];
}
}
for(int i=1;i<=n;i++){
// cout<<i<<' '<<d[i]<<endl;
if(d[i]==2e9){
cout<<i-1;
break;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |