#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int t[N];
vector<int> fv,bv;
vector<int>::iterator it;
stack<pair<int,pair<int,int> > > st;
int main(){
int n,m;
cin>>n >>m;
for(int i=1;i<=n;i++) cin>>t[i];
bv.push_back(t[n]);
for(int i=n-1;i>=1;i--){
if(t[i]<bv.back()){
bv.push_back(t[i]);
continue;
}
it=lower_bound(bv.begin(),bv.end(),t[i],greater<int>());
bv[it-bv.begin()]=t[i];
}
cout<<bv.size();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
75 ms |
3004 KB |
Output is correct |
2 |
Correct |
57 ms |
2896 KB |
Output is correct |
3 |
Correct |
60 ms |
2896 KB |
Output is correct |
4 |
Correct |
57 ms |
2896 KB |
Output is correct |
5 |
Correct |
34 ms |
2764 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
968 KB |
Output is correct |
2 |
Correct |
15 ms |
1112 KB |
Output is correct |
3 |
Correct |
14 ms |
1072 KB |
Output is correct |
4 |
Incorrect |
9 ms |
1116 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
1584 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |