#include <bits/stdc++.h>
using namespace std;
int lis(vector<int>& arr)
{
vector<int> ans;
int n = arr.size();
for (int i = 0; i < n; i++) {
auto it
= lower_bound(ans.begin(), ans.end(), arr[i]);
if (it == ans.end()) {
ans.push_back(arr[i]);
}
else {
*it = arr[i];
}
}
return ans.size();
}
int main()
{
int n,x,a;
cin>>n>>x;
int q=n;
vector<int>v;
while(q--){
cin>>a;
v.push_back(a);
}
cout<<lis(v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
102 ms |
1420 KB |
Output is correct |
2 |
Correct |
97 ms |
1336 KB |
Output is correct |
3 |
Correct |
103 ms |
1344 KB |
Output is correct |
4 |
Correct |
99 ms |
1340 KB |
Output is correct |
5 |
Correct |
68 ms |
1968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
588 KB |
Output is correct |
2 |
Correct |
34 ms |
680 KB |
Output is correct |
3 |
Correct |
24 ms |
664 KB |
Output is correct |
4 |
Incorrect |
18 ms |
624 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
50 ms |
912 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |