#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 |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
1200 KB |
Output is correct |
2 |
Correct |
60 ms |
1108 KB |
Output is correct |
3 |
Correct |
76 ms |
1184 KB |
Output is correct |
4 |
Correct |
55 ms |
1104 KB |
Output is correct |
5 |
Correct |
36 ms |
1740 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
604 KB |
Output is correct |
2 |
Correct |
14 ms |
540 KB |
Output is correct |
3 |
Correct |
14 ms |
604 KB |
Output is correct |
4 |
Incorrect |
9 ms |
724 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |