# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
996623 | vjudge1 | Rabbit Carrot (LMIO19_triusis) | C++17 | 57 ms | 5320 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>
using namespace std;
#define pb push_back
#define ll long long
#define f first
#define s second
int main() {
int n, m;
cin >> n >> m;
vector<ll> v;
for (int i = 1; i <= n; i++) {
ll a;
cin >> a;
v.pb((a - (m * i)));
}
reverse(v.begin(), v.end());
vector<ll> v1;
for (int i : v) {
if (i <= 0) {
int pos = upper_bound(v1.begin(), v1.end(), i) - v1.begin();
if (pos == v1.size()) {
v1.pb(i);
} else {
v1[pos] = i;
}
}
}
cout << n - v1.size() << endl;
}
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... |