# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743714 | moonpay | Rabbit Carrot (LMIO19_triusis) | C++17 | 28 ms | 8400 KiB |
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>
#define int int64_t
using namespace std;
const int modm = 1e9 + 7;
const int maxn = 2e3 + 5;
int lis(vector<int> &a) {
vector<int> dp;
for (int i: a) {
int pos = upper_bound(dp.begin(), dp.end(), i) - dp.begin();
if (pos == dp.size()) {
dp.push_back(i);
} else {
dp[pos] = i;
}
}
return dp.size();
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<int> a(n + 1);
a[0] = -m * n;
for (int i = 0; i < n; i++) {
cin >> a[i + 1];
a[i + 1] += (n - i - 1) * m;
a[i + 1] *= -1;
}
vector<int> ne;
for (auto p: a) {
if (p >= a[0]) {
ne.push_back(p);
}
}
cout << n + 1 - lis(ne);
}
Compilation message (stderr)
# | 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... |