#include<bits/stdc++.h>
using namespace std;
int main()
{
int m,n,a[200001];
cin>>n>>m;
for(int i=0;i<n;++i)
{
cin>>a[i];
a[i] = -a[i];
}
vector<int> v;
for(int i=0;i<n;++i)
{
auto it = upper_bound(v.begin(),v.end(),a[i]);
if(v.empty() || it == v.end())
{
v.push_back(i);
}
else
{
*it = a[i];
}
}
int ans = v.size()-1;
if(-a[0]>m) ans = n;
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1116 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Incorrect |
1 ms |
1116 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1116 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Incorrect |
1 ms |
1116 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1116 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Incorrect |
1 ms |
1116 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1116 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Incorrect |
1 ms |
1116 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |