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>
#define pb push_back
#define sz(x) ((int)((x).size()))
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef vector<int> vi;
const int N=2e5+10;
int n, x, t[N];
int main(){
cin>>n>>x;
for(int i=0; i<n; i++){
cin>>t[i];
}
assert(x==0);
vi lis;
for(int i=0; i<n; i++){
int in=lower_bound(all(lis), t[i])-lis.begin();
if(in==sz(lis)){
lis.pb(t[i]);
}else {
lis[in]=t[i];
}
}
cout<<sz(lis)<<"\n";
}
# | 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... |