#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, x, i;
cin >> n >> x;
vector <ll> xd;
xd.assign(n, 0);
for(i=0;i<n;i++) {
cin >> xd[i];
}
vector<ll> lol = {xd[0]};
for (i = 1; i < n; ++i) {
if (xd[i] > lol.back()) {
lol.push_back(xd[i]);
}
else {
auto it = lower_bound(lol.begin(), lol.end(), xd[i]);
*it = xd[i];
}
}
cout << lol.size() << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
1908 KB |
Output is correct |
2 |
Correct |
83 ms |
1848 KB |
Output is correct |
3 |
Correct |
111 ms |
1872 KB |
Output is correct |
4 |
Correct |
86 ms |
1856 KB |
Output is correct |
5 |
Correct |
53 ms |
2992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
596 KB |
Output is correct |
2 |
Correct |
20 ms |
596 KB |
Output is correct |
3 |
Correct |
20 ms |
696 KB |
Output is correct |
4 |
Incorrect |
18 ms |
980 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
1068 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |