This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define i64 long long
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
const int INF = 1e9;
void Maximize(pair<int, int> &a, pair<int, int> b) {
if (a.first < b.first) a = b;
else if (a.first == b.first) a.second = min(a.second, b.second);
}
void Solve(void) {
int N, D; cin >> N >> D;
vector<int> a(N + 1);
for (int i = 1; i <= N; i ++) cin >> a[i];
vector<int> lis;
for (int i = 1; i <= N; i ++) {
auto it = lower_bound(all(lis), a[i]);
if (it == lis.end()) lis.pb(a[i]);
else (*it) = a[i];
}
cout << (int)lis.size() << "\n";
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(0);
cout << fixed << setprecision(10);
int Tests = 1; // cin >> Tests;
while (Tests --) {
Solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |