Submission #413712

# Submission time Handle Problem Language Result Execution time Memory
413712 2021-05-29T09:23:51 Z duyanh1704 Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int inf = 1e18 + 9;
int n, m, res;
int a[200005];

signed main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; ++i){
        int x; cin >> x;
        a[i] = m * i - x;
    }

    vector<int> f(n + 5, inf);
    f[0] = -inf;
    for (int i = 1; i <= n; ++i){
        int k = upper_bound(f.begin(), f.end(), a[i]) - f.begin();
        res = max(res, k);
        f[k] = a[i];
    }

    cout << n  - res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -