| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1232982 | adad | Rabbit Carrot (LMIO19_triusis) | C++20 | 0 ms | 324 KiB | 
#include <bits/stdc++.h>
#define TASK ""
#define MASK(i) (1<<(i))
#define BIT(x, i) (((x)>>(i))&1)
#define int long long
#define fi   first
#define se   second
using namespace std;
const long long INF = 1e17, MOD = 1e9 + 7, MAX = 2e5 + 5;
int n, M, h[MAX], tmp[MAX];
vector <int> lis;
signed main() {
    if (fopen(TASK ".INP", "r")) {
        freopen(TASK ".INP", "r", stdin);
        freopen(TASK ".OUT", "w", stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> M;
    for(int i = 1; i <= n; i ++) cin >> h[i];
    int len = 1;
    for(int i = 1; i <= n; i ++) {
        if (M * i - h[i] >= 0) {
            tmp[++len] = M * i - h[i];
        }
    }
    for(int i = 1; i <= len; i ++) {
        auto pos = upper_bound(lis.begin(), lis.end(), tmp[i]);
        if (pos == lis.end()) lis.push_back(tmp[i]);
        else *pos = tmp[i];
    }
    cout << n - lis.size();
}
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... | ||||
