# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
749261 | PanosPask | Rabbit Carrot (LMIO19_triusis) | C++14 | 1 ms | 212 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;
typedef long long ll;
int n, m;
vector<int> a;
vector<ll> d;
int main(void)
{
scanf("%d %d", &n, &m);
a.resize(n);
d.assign(n+1, INT_MIN);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
d[0] = INT_MAX;
for (int i = 0; i < n; i++) {
ll curval = a[i] - m * i;
int l = 0;
int r = n + 1;
while (r > l + 1) {
int mid = (l + r) / 2;
if (d[mid] >= curval)
l = mid;
else
r = mid;
}
d[l+1] = curval;
}
int ans = 0;
for (int i = 0; i < n + 1; i++)
if (d[i] != INT_MIN)
ans = i;
printf("%d\n", n - ans);
return 0;
}
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... |