# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1256340 | menkh | Rabbit Carrot (LMIO19_triusis) | C++17 | 69 ms | 12872 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 200005
int poles[MAX], b[MAX];
int n, m;
void solve() {
scanf("%lld %lld", &n, &m);
for (int i = 1; i <= n; i++) scanf("%lld", &poles[i]);
for (int i = 1; i <= n; i++) b[i] = m * i - poles[i];
multiset<int> s;
for (int i = 1; i <= n; i++) {
if (b[i] < 0) continue;
auto it = s.upper_bound(b[i]);
if (it != s.end()) s.erase(it);
s.insert(b[i]);
}
printf("%lld\n", n - (int)s.size());
}
signed main() {
solve();
}
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... |