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;
typedef long long ll;
int main(){
int n,d;
cin>>n>>d;
vector<ll> x;
for(int i=0;i<n;i++){
ll a; cin>>a;
x.push_back(a);
}
vector<ll> lis;
for(int i=0;i<n;i++){
if(lis.empty()){
lis.push_back(x[i]);
continue;
}
auto it=lower_bound(lis.begin(),lis.end(),x[i]);
if(it==lis.end()) lis.push_back(x[i]);
else{
int id=it-lis.begin();
lis[id]=x[i];
}
}
cout<<lis.size()<<endl;
}
# | 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... |