#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 3;
int ar[N];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, x; cin >> n >> x;
for(int i=1; i<=n; ++i) cin >> ar[i];
vector<int> lis;
for(int i=1; i<=n; ++i) {
auto t = lower_bound(lis.begin(), lis.end(), ar[i]);
if(t == lis.end()) {
lis.emplace_back(ar[i]);
}else {
*t = ar[i];
}
}
cout << lis.size() << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
1260 KB |
Output is correct |
2 |
Correct |
25 ms |
1256 KB |
Output is correct |
3 |
Correct |
24 ms |
1104 KB |
Output is correct |
4 |
Correct |
22 ms |
1104 KB |
Output is correct |
5 |
Correct |
15 ms |
1772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
592 KB |
Output is correct |
2 |
Correct |
9 ms |
592 KB |
Output is correct |
3 |
Correct |
6 ms |
592 KB |
Output is correct |
4 |
Incorrect |
5 ms |
848 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
1016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |